[sudo-users] executing a command as another user w/o password
Todd C. Miller
Todd.Miller at courtesan.com
Fri Jun 3 08:45:34 EDT 2011
On Thu, 02 Jun 2011 18:29:23 PDT, kz0twk-unix at yahoo.com wrote:
> i need to setup sudo so that user1 can issue a command as user2 without enter
> ing a password. i tried the following entry in the sudoers file:
>
> user1 ALL=(user2) NOPASSWD: /bin/kill
>
> but when logged in as user1 and execute the command
>
> sudo -u user2 -i /bin/kill -15 3948
>
> i get prompted for the password. why does this not work or what do i need to
> do to make it work.
There's no need to use the -i option here. What that will do is
wrap the command in a shell so sudo will check to see if user1 is
allowed to run the shell, not /bin/kill. If you do:
sudo -u user2 /bin/kill -15 3948
it should work without a password.
- todd
More information about the sudo-users
mailing list