Thursday, June 13, 2013

Ubuntu Add User to Sudoers

Sudo Users in Ubuntu
Sudo vs Adminstrator Groups
Add User to Sudoers
Add Administrator User

Ubuntu Sudo Users

All members of the group admin, are in Ubuntu by default allowed to use sudo, so the easiest way is to add the user account to the admin group.

If you do not want to give the user account full root access, you need to edit the /etc/sudoer file with visudo (it makes sure that you do not have any syntax errors in the file and lose sudo capability altogether) in a way that you specify what commands this user (or a new group) can execute as root.

The sudoer manual will give you more information about this. You can specify which commands are permitted by a particular user/group to be executed as root.

Difference between Sudo and Admin Groups:


Administrators are added to the sudo group, but the admin group is supported for backward compatibility. From the release notes:
Up until Ubuntu 11.10, administrator access using the sudo tool was granted via the admin Unix group. In Ubuntu 12.04, administrator access will be granted via the sudo group. This makes Ubuntu more consistent with the upstream implementation and Debian. For compatibility purposes, theadmin group will continue to provide sudo/administrator access in 12.04.
It is not created when you do a fresh install, though it is still present if you upgraded from previous distributions. Either way, the admin group appears in the /etc/sudoers file.
sudo adduser <username> sudo

This works because /etc/sudoers is pre-configured to grant permissions to all members of this group (You should not have to make any changes to this):
# Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL

As long as you have access to a user that is in the same groups as your "original" user, you can delete the old one.

Realistically, there are also other groups your new user should be a member of. If you set the Account type of a user to Administrator in Users Settings, it will be placed in at least all of these groups:
adm sudo lpadmin sambashare
Because your system configuration may vary, I suggest taking a look at the output of groups <username> to see what groups are normally in use.


Add new Administrator User


Ubuntu system preferences Icon from the dock
Ubuntu sudo users can also be added in the user accounts pane of system preferences in Ubuntu 12.04 LTS and later. This is an easy way to add a user as a sudo user or system administrator.

Step 1. Click on the system preferences icon in the dock.
Step 2.  Click on the User Accounts button.
Step 3. Unlock user accounts by clicking the unlock button.

Ubuntu Add user to sudoers and add user as administrator

Step 3.a When prompted enter the password for your user account.

Step 4.  Under the My Account table select the + .

Unlock ubuntu user accounts pane with administrative password of any user


Step 4.a Select the type of account as Administrator.
selecting the account type as administrator

Step 4.b Enter the Full name of the user and create a user name or use the default. Then click Create.
creating an administrator account Ubuntu
Step 5. Now that the user has been created a password must be created for it.
create password for new sudo user account disabled

Step 5.a Click on Account Disabled, then enter a password for the new user and click change.
ubuntu password strength

Finish The new user will now be able to make administrative changes as a sudoer.
use another sudo user to authenticate


Source: StackExchange


Related Posts:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...