Hi again Lars, and everybody.
I've written the following line into sudoers configuration
Code:
Cmnd_Alias SHUTDOWN_CMDS = /sbin/shutdown -r 1
because I pretend only to allow to run "shutdown" command for "-r 1" without password, so, if i run i shutdown -r now or shutdown -r 5 it's needed to write a password.
Do you know if it's possible?, because it seems that with sudoers line as described above, a password is required anyway.
Another thing, when i execute the shutdown command from a remote machine this configuration doesn't work.
I have this script reinicio.sh (with x permission)
Code:
#!/bin/bash
sudo service apache2 stop
sudo service apache2 status
ssh -t remoteuser@remotemachine sudo /etc/init.d/mysql stop
ssh -t remoteuser@remotemachine sudo /etc/init.d/slapd stop
ssh -t remoteuser@remotemachine sudo /sbin/shutdown -r 1 Mensaje
I run the script but it asks for a password for remoteuser@remotemachine when it tries ssh -t .... command, although this line is configured in remote sudoers file.
Code:
Cmnd_Alias CMDS = /sbin/shutdown, /etc/init.d/mysql, /etc/init.d/slapd
....
Code:
remoteuser ALL = NOPASSWD: CMDS
Regards and thanks in advance for your help
Andres
Bookmarks