Passwordless su commands PDF Print E-mail
Written by JLangbridge   
Monday, 27 April 2009 13:47

On some machines, it can be useful for some users to run specific commands as root, and to not have a root password, or any sort of password for that matter. I had a netbook where I needed the user to be able to restart or halt his computer without any password, and without any form of authentication. To do this, we need to edit the su user configuration file, so type:

sudo visudo

This opens up an editor and shows the contents of the sudoers file. Add the following line:

user ALL=NOPASSWD:/sbin/halt, /sbin/reboot

The user "user" can now run "su halt" and "su reboot" without being asked for a password. This can, of course, be applied to other commands, just separate them with a comma, and don't forget to use entire paths. 

Last Updated on Monday, 29 June 2009 20:32
 

Comments  

 
0 # Excellent!Doug 2010-11-05 09:46
Excellent stuff! This is exactly what I needed. Short and precise, just the way
I needed it. Thanks!
Reply | Reply with quote | Quote
 

Add comment


Security code
Refresh