How to Add User to Sudoers or Sudo Group on Arch Linux

Sudo allows a user to run commands or programs with security privileges of another user ( by default superuser). Superuser in Linux is called 'root'.

It is one of the best security practice is to use non-root user to perform server administration.

In this quick article, we are going to create a user and add to a sudo group in Arch Linux.

Add to sudo group

As mentioned before sudo command allows you to run programs with the privileges of the superuser. In Arch Linux, sudo is not part of the base installation. So, if you haven't install sudo, then install with the following command.

# pacman --sync sudo

Also, install vi editor.

# pacman --sync vi

Now, add a user also state to make its home directory by option --create-home

# useradd --create-home john

Assign password,

# passwd john
Add user in Arch Linux
Add user in Arch Linux

Wheel group is the sudo group in Arch Linux. So at this point add newly created user 'john' to the wheel group with the help of command usermod.

# usermod --aG wheel john

Now edit the file sudoers so that the wheel group is activated. To do this, open the sudoer's file and uncomment the line  %wheel ALL=(ALL) ALL

# visudo

The final outcome should be like:

Uncomment Sudoers file in Arch Linux
Uncomment Sudoers file in Arch Linux

Save and exit visudo. Press Esc then : wq and press Enter

Now, test your configuration by switching to user john and using id command to show the group. You should see root when you type the command sudo whoami.

# su - john

$ id

$ sudo whoami
Check sudo user in Arch Linux
Check sudo user in Arch Linux

Removing users  from the Sudoers group

If you like to remove a user from sudo ( wheel group) use gpasswd tool as below. In our case, the user is john,

# gpasswd -d john wheel


We showed you how to add users to sudo group on Arch Linux. We suggest you use sudo user rather than the root user while performing the administrative tasks.  This also helps to provide appropriate permission to the right person.  Thank you for getting here.

Leave a Comment