Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
Do both users actually exist in in /etc/passwd? Check for any errant leading/trailing slashes or uncommented lines? –  Garrett Nov 15 '11 at 3:58
    
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 Nov 15 '11 at 4:31
add comment

1 Answer 1

up vote 1 down vote accepted

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!

share|improve this answer
    
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 Nov 18 '11 at 7:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.