Whats wrong with this entry in the /etc/sudoers file?

0

I am trying to let user2 run a particular script - script.sh that belongs to user1 and allow him(user2) to run as the script's owner, user1. So I made an entry in the /etc/sudoers file, however visudo shows an error, but doesnt specify. Here is what I have-

#User priveilege specification
root ALL=(ALL) ALL

#The following line gives an error
user2 ALL=(user1) /home/user1/bin/script.sh

OS: Ubuntu 10.4

Sri Kadimisetty

Posted 2011-11-15T03:46:46.187

Reputation: 329

Do both users actually exist in in /etc/passwd? Check for any errant leading/trailing slashes or uncommented lines? – Garrett – 2011-11-15T03:58:39.737

I did. There doesnt seem to be any syntax errors I can spot. Will get other people to look at it so I can be sure. Thanks for looking @gman – Sri Kadimisetty – 2011-11-15T04:31:16.980

Answers

1

Well, I would say to create a new group and add the users (user1 and user2) to that new group.

After that you would add up the below entry on the sudoers.

newgroup ALL=(ALL) /home/user1/bin/script.sh

Cheers!

maneeshshetty

Posted 2011-11-15T03:46:46.187

Reputation: 572

Are you sure? Looks like both users will then be able to impersonate any other user when running that script which can be edited by at least one of them. I.e. a really bad idea. – Daniel Beck – 2011-11-18T07:12:11.550