Trying to figure out the correct Cmnd_Alias for the sudoers file
The command i which to run without any password is the following:
sudo /usr/bin/nohup /etc/init.d/axtty start >/dev/null 2>&1
The lines i have added to sudoers file is:
## Cmnd alias specification Cmnd_Alias AXTOOLTTYSTART = /usr/bin/nohup /etc/init.d/axtty start >/dev/null 2>&1 Cmnd_Alias AXTOOLTTYSTOP = /etc/init.d/axtty stop Cmnd_Alias AXTOOLTTYSTATUS = /etc/init.d/axtty status Cmnd_Alias AXTOOLINTCTLSTART = /sbin/initctl start ttyp? Cmnd_Alias AXTOOLINTCTLSTOP = /sbin/initctl stop ttyp? ## This will disable password request for the axtools commands %sudoaxtools ALL=(root) NOPASSWD: AXTOOLTTYSTART, AXTOOLTTYSTOP, AXTOOLTTYSTATUS, AXTOOLINTCTLSTART, AXTOOLINTCTLSTOP Defaults!AXTOOLTTYSTART !requiretty Defaults!AXTOOLTTYSTOP !requiretty
The command in mention is ran inside a script (axopen), executed either by member of group sudoaxtools or root's crontab
#!/bin/sh SUDO='' if (( $EUID != 0 )); then SUDO='sudo' fi echo -n "Checking for open connections" while netstat -d | grep -q axel do ((c++)) && ((c==900)) && break echo -n "." sleep 4 done echo "done" echo "Starting axtty service.." $SUDO /usr/bin/nohup /etc/init.d/axtty start >/dev/null 2>&1 sleep 4 $SUDO /etc/init.d/axtty status
When axopen is executed på member of sudoaxtools, then it still prompts for password. I expect its because of the
>/dev/null 2>&1 pieces.
The reason i'm using nohup is because the service for some reason will not start, when executed simply using
sudo /etc/init.d/axtty start
So if someone have ideas to fix that, it will be great as well.