Linux - Arch How to Set up SUDO

Arch Linux is known to not be the most user friendly distro because it does not come with most of the packages other distros installs and configures by default.

sudo is well known tool that allows a system administrator to delegate authority to other users.

1) Installing Sudo

Let's install and basically configure sudo in our Arch box.

pacman -S sudo

After the installation you might want to change the default text editor used by visudo to edit the /etc/sudoers configuration file.

export EDITOR=vim

In my case, because I like to use vim I have added the above line to my bashrc file.

2) Adding a new Adminstrator

Let's create our new administrator.

useradd -c 'Management User' tiago

I am going to follow the tip on the Arch Linux wiki about adding new administrators to the system adding the recently created user to the wheel group.

usermod -a -G wheel tiago
Add the user the a group without removing it from other groups.
getent group wheel

3) Setting Permissions

It's time to allow the members of the wheel group to use sudo. Let's edit the sudoers file adding the below:

Launching the sudoers file.

## User privilege specification

# Allows the members of the group execute any commands, but not as any user. Only as root.
%wheel ALL=ALL



With the steps above we have set up a basic adminstrator in our system. However, sudo is very powerful and extremely customisable. For more sophisticated settings and permissions check the links listed below and the file /usr/share/doc/sudo/examples/sudoers.


Sudo - ArchWiki
sudoers(5) — Arch manual pages
Polkit - ArchWiki
Environment variables - ArchWiki

Share Tweet Send
You've successfully subscribed to Infoitech - [B]logging
Great! Next, complete checkout for full access to Infoitech - [B]logging
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.