How to Enable the SUDO Command on Your Linux Network - dummies

How to Enable the SUDO Command on Your Linux Network

By Doug Lowe

If you are administering a Linux network, you’ll see many examples of commands entered in a terminal window that begin with the word sudo. This command is an essential part of Linux administration. It lets you execute Linux commands with permissions of the root user account.

The sudo command is required because many Linux administrative commands can only be run under by the root user. You could simply log in as the root user to run such commands, but that practice is risky because the root user can do virtually anything in a Linux environment. It’s safer to log in with an ordinary user account and use sudo to enable access to administrative functions.

For example, you’ll often use the dnf command to install new software on a Linux system. The dnf command is one of those commands that can only be run by the root user. So, you’ll need to use sudo to run the dnf command. To use sudo, you simply prefix the command you want to run with the word sudo, as in the following example:

sudo dnf install dhcp

Here, the command dnf install dhcp will be run as the root user. Note that for security purposes, the sudo command prompts you for your own password before it runs the dnf command.

To enable your user account for sudo, the root user must add your account name to a group called wheel, because by default the sudo program is configured to allow all users in this group to run commands as the root user. To add yourself to the wheel group, you must edit a configuration file called group, which is found in the etc/ folder. Here are the steps to edit this file:

1Log in as the root user.

The Gnome desktop appears.

The Linux File Manager window.

2Click Activities at the top left of the Gnome desktop, and then choose Files.

The File Manager appears.

Root level files in the Linux system.

3Click Computer in the navigation pane on the left side of the File Manager window.

The folders at the computer’s root level appear.

4Double-click the etc folder.

The files in the etc folder appear.

The gedit text editor.

5Locate and double-click the file named group.

The group file is opened in the gedit text editor.

6Locate the line that starts with wheel:x:10: and add your username to the end of this line.

If your username is dlowe, you can the line to read as follows:


7Click the Save button.

The group file is saved with your changes.

8Close the gedit and File Manager windows.

You’re done! You can now use the sudo command.