How to add a new user with sudo rights

Sudo Sandwich
Image by xkcd – CC BY-NC 2.5

Let’s say you have a new user needing sudo access to a Linux server. How do you grant him/her this great privilege? First, explain to the new user that sudo rights allow to do pretty much anything on a Linux machine – including screwing everything up! – and that with greater power also comesĀ  greater responsibilities. Then, follow this procedure:

1. Open the command line

2. Create a new user (e.g. newusername) and add it to group wheel (members of this group have sudo rights):

3. Set up the password for the new user. First, login as root:

Then set the password for the new user (e.g. newusername):

Finally exit from root with:

4. Test the newly created user and password by logging in as user newusername:

5. Test that the newly created user is in group wheel:

Leave a Reply

Your email address will not be published. Required fields are marked *