Thursday, October 7, 2010

[Level 1] How to grant sudo without password in Ubuntu

If you want to grant root permission to user with sudo,
and also let user doesnot need to input his password while using sudo.
Just add pattern in your visudoers:
username host=NOPASSWD: commands/ALL
Ex.
# visudo 
[original contents]
...
%admin ALL=(ALL) ALL
...
[add new line]
stanley ALL=(ALL) NOPASSWD: ALL

PS. For above example, if user is inclued in admin group, please make sure new line is added at the below of group setting, or group setting will overwrite your setting and let use have to input his password while using sudo.

Wish this helps.
regards,
Stanley Huang