Allow sudo access without passwords in Ubuntu

by
Ryan
on
November 21, 2008

To give a specific user access to sudo without having to enter a password you have to edit the /etc/sudoers configuration file. For security reasons you should only edit the file using the visudo command.

$ sudo visudo

In Ubuntu the following lines are placed at the bottom of /etc/sudoers by default. This gives your default user access to sudo as well as any other user in the admin group.

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

If you want to allow sudo access without passwords for all users in the admin group you can simply add the NOPASSWD option to this line and be done.

%admin ALL=(ALL) NOPASSWD: ALL

If you want to give a specific user sudo access without passwords, you will have to add an additional line for each user. These lines will conflict with the default admin line above so they must be placed at the end of the sudoers file. The reason for this is that sudo will handle contradicting configuration lines by giving priority to the line closest to the bottom of the file.

Add the following line to the end of the file, replace ‘ryan’ with your username.

ryan    ALL=(ALL) NOPASSWD: ALL

Add a line for each user that you wish to have access.

For more ways to use and configure sudo have a look here.

No Comments
ubuntu
, , , , , , ,

No related posts.

Comments (0)

No comments yet

Trackbacks (0)

No trackbacks yet

Leave a Comment

(displayed with your post)
(will not be published)
(optional)
Copyright 2008-2010 WiredRevolution.com. All rights reserved.