I have to execute a shell script as another user, but without be prompted for password.
I've edited the etc/sudoers file with visudo, adding the following line.
_www localhost=(otheruser) NOPASSWD:/patho/to/my/script.sh
If I understand how sudo works, this means that user _www is allowed to execute like user 'otheruser', without be prompted for password, only from localhost.
is that correct?
the system continue to prompt for the password...
/patho/to/my/script.sh
, which is not enough. You should add/bin/sh
to make it an executable command. All together,/bin/sh /patho/to/my/script.sh
.