Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'd like to allow one of my users to execute commands as another user on my Ubuntu Lucid server.

I'm struggling with finding the syntax for the sudoers file to do this. Say I'm connecting to the box with a user called 'ludo', and I want ludo to be able to execute commands as the 'django' user. eg:

sudo -u django

I'd like to be able to execute /any/ commands as the django user, and without prompting for a passsword. All the examples I find are for a restricted subset. I did attempt something but got a syntax error upon exiting visudo so I bottled it.

Thanks :)

share|improve this question

2 Answers 2

up vote 6 down vote accepted

You can put the user to run as in parentheses before the command list:

ludo ALL = (django) NOPASSWD: ALL
share|improve this answer
    
Superb - thank you :) –  Ludo Nov 2 '10 at 16:48

According to sudoers(5) adding the line ludo ALL = /usr/bin/su django in the sudoers file should do the trick.

share|improve this answer

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.