Distinguishing Between the ‘sudo’ and ‘admin’ Groups in Linux: Roles and Usage

In order to grant superuser privileges to ordinary users, Linux requires us to place the desired user accounts into a designated group for administrators. This group can have different names across various Linux distributions and system versions, such as sudo, admin, and wheel. Regardless of the name that your system uses, the group is granted superuser privileges by the settings within the /etc/sudoers configuration file. In this tutorial, we will explain the difference between the sudo, admin, and other similar user groups on a Linux system.

In this tutorial you will learn:

  • What is the difference between sudo and admin groups in Linux?
  • How to grant superuser privileges through editing the /etc/sudoers file
Distinguishing Between the 'sudo' and 'admin' Groups in Linux: Roles and Usage
Distinguishing Between the ‘sudo’ and ‘admin’ Groups in Linux: Roles and Usage
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Administrator / Superuser Groups in Linux




As you probably already know after using Linux for just a day or two, the root user account is the administrator account on a Linux system. This account has full control and privileges over the entire system, including all of the files owned by various other users.

In addition to the root user account, ordinary users can be given root permissions, and access these permissions through use of the sudo command. This bring us to the question: Which users are given sudo access, and how?

The answer lies inside of the /etc/sudoers configuration file. This file specifies who is able to access root (sudo) permissions. More specifically, it specifies which user group retains root permissions. Then, to give a specific user access to sudo, we simply add that user to the group.

The confusion that arises is from various Linux distributions using their own naming convention for this group. Debian based systems like Ubuntu Linux use the sudo user group. Therefore any account in the sudo group will be able to execute commands with root permissions. Conversely, Red Hat based distributions like Fedora Linux name the administrator group wheel. On these systems, an ordinary user must be placed in the wheel group to be given the ability to execute commands as root.

To add further confusion, you may also see the admin user group configured to grant root permissions in your /etc/sudoers file. Certain systems still use this naming convention, including older Ubuntu systems prior to the Ubuntu 12.04 LTS release. Even in more recent versions of the operating system, the admin group remains part of the file to retain backward compatibilty. You can see this for yourself by examining the /etc/sudoers file in Ubuntu:

Viewing the /etc/sudoers file on Linux
Viewing the /etc/sudoers file on Linux




As you can see in the screenshot above, our system is using both the sudo and admin groups to grant root privileges to users. Both of these will work the same.

NOTE
For Ubuntu, the sudo user group has superceded the admin group. The process for granting root privileges for a user, on recent Ubuntu versions, is to use the sudo group instead of the older admin group, which is only retained for backward compatibilty.

Closing Thoughts

In this tutorial, we saw how to distinguish between the sudo and admin user groups on a Linux system. We also learned about the wheel user group, which is used on other types of Linux distributions. These groups simply allow their members to execute commands with root privileges, and all of them have the same effect. The one you should use just depends on your specific distribution of Linux and what version you are running.



Comments and Discussions
Linux Forum