2014年4月21日 星期一

Add User to “sudoers” File

from:http://benaiah41.wordpress.com/2008/08/15/37/
To give a user the ability to use the “sudo” command you must add them to the “sudoers” file.  Here’s how.
Thanks to ubuntucat (see comment below) for the following suggestion!  The easiest way to allow a user to sudo is to simply run the following command from the Terminal:
To open the Terminal:
Applications >> Accessories >> Terminal
Once the Terminal is open type:
sudo adduser username admin
This must be done from an account that already has sudo abilities or else from the root account.
If for some reason you have to manually edit the “sudoers” file keep reading!
Open the file “sudoers” located at /etc/sudoers using your favorite text editor.  You must have root permissions to be able to edit this file so you will want to open your editor from the command line.
To use gedit you would do the following:
Open the Terminal and type:
sudo gedit /etc/sudoers
If you want to use vim you can simply enter the following into the Terminal:
sudo visudo
Once you have the sudoers file open, scroll down to the line:
root   ALL = (ALL)    ALL
Add the folling line below the root line (replacing “user” with the name of the account you wish to give sudo access to)
user   ALL = (ALL)    ALL
Save and close the file.  The new user has now been added to the “sudoers” file and can use the “sudo” command.

沒有留言: