Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Apr 212010

Add a user that can gain root privileges in Ubuntu


You have created a user, and now you want to make this user (e.g. peter as an example) can gain root privileges.

Firstly, check your /etc/sudoers file

# sudo cat /etc/sudoers

You might found the following lines

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

Method 1

If you have the line %admin ALL=(ALL) ALL, then you can add the user (e.g peter) to the admin group using the command:

# sudo usermod -g admin peter

Method 2

Or you can edit the file /etc/sudoers to add your account manually

# sudo visudo

Append peter ALL=(ALL) ALL at the end..

%admin ALL=(ALL) ALL
john ALL=(ALL) ALL
peter ALL=(ALL) ALL

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>