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

I'd like to be able to su to another user to run a script with reduced permissions. Unfortunately I have to type the password in every time, is there a way to create a user without needing the password prompt?

share|improve this question

2 Answers 2

up vote 14 down vote accepted

Try sudo.

Add the following to your sudoers file (by running visudo):

%you ALL= (restricted) NOPASSWD: ALL

where you is your username and restricted is your reduced privilege user.

You can then run commands as restricted without supplying a password:

sudo -u restricted whoami

You can also limit what commands can be executed via sudo by replacing the ALL at the end of the line with the command line you want to allow. See man sudoers for more information.

share|improve this answer
    
Another advantage of sudo is that it logs all commands to syslogd –  Mikeage Apr 30 '09 at 11:07

You can su to root, and then when you su to another user, the password is not required.

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.