After I add a user using adduser, I can't see it via System->Administration->Users and Groups unless I logout then login again. Is that normal?

Also, can I set a newly added user as a sudoer or do I have to change that only after adding it? How can I do that via the shell?

Finally, can I delete the original user that was created upon initial installation of ubuntu, or is this user somehow 'special'?

link|improve this question

57% accept rate
feedback

4 Answers

up vote 15 down vote accepted

Just add the user to the "Administer the system" (admin) group:

sudo adduser <username> admin

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):

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

You should be able to see the changes immediately in the Users Settings window.

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 dialout fax cdrom floppy tape dip video plugdev fuse lpadmin admin sambashare

Because your system configuration may vary, I suggest taking a look at Users Settings --> Advanced Settings to see what groups are normally in use.

link|improve this answer
Thanks, but if I add my user to admin I can later add myself to any other groups as well, right? – David B Oct 15 '10 at 12:44
Anybody who has root privileges can add himself to any group. If you give someone full sudo privileges, that is what you get, does not matter if as user or as member of admin. If you want to give less privileges, you need to specify this in the sudoer file – txwikinger Oct 15 '10 at 12:49
In 10.10 /etc/sudoers I have this: # Allow members of group sudo to execute any command %sudo ALL=(ALL) ALL So, do I need to run sudo adduser name sudo instead? – Dziamid May 16 '11 at 16:48
1  
@Dziamid I'm not sure what the sudo group is for. Let's find out. – ændrük May 17 '11 at 1:49
feedback

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.

link|improve this answer
I thought that was what the wheel group was for? – Marco Ceppi Oct 15 '10 at 13:05
@Marco I'm not familiar with that. Can you explain a little more? – ændrük Oct 15 '10 at 13:19
@MarcoCeppi, the wheel group was used on some systems to restrict what users could use su. Ubuntu uses sudo and the admin group. – psusi Nov 17 '11 at 15:03
feedback

Open Sudoyers file

sudo visudo

will open the /etc/sudoyers file in GNU nano

if not try export EDITOR="nano" and try again sudo visudo

add the below line to the end of file

mithun ALL=(ALL) ALL

Then perform WriteOut witthe the CTRL+O

Editor will ask you for the file name to be written

default will be /etc/sudoers.tmp

File Name to Write: /etc/sudoers.tmp

Change that to /etc/sudoers

File Name to Write: /etc/sudoers

A prompt will be dispalyed

File exists, OVERWRITE ?

or

Save file under DIFFERENT NAME ?

In both cases, press Y

Quit the nono editor with CTRL+X

Done!

link|improve this answer
feedback

Ubuntu Forums Link | Add Sudoer

echo 'useraccount ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

You can type the above command with your user by sudo echo and the rest of the line as above.

Hope that Helps

link|improve this answer
1  
Editing /etc/sudoers manually is just asking for trouble. Always use visudo. – ændrük Oct 15 '10 at 12:22
Also the redirection ( >> ) will fail because that is done before sudo and you don't have access to the file. – psusi Nov 17 '11 at 15:02
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.