Introduction
A "sudo" user is a user that has extra privileges. It can have just some extra privileges or full root access. However, the most common use for a sudo user on a cPanel server is to create an administrative user that can gain root access on the server. Creating a sudo user with root privileges needs to be done, for instance, if you wish to disable direct root logins. (Find out how to disable direct root logins in this article.)
Additionally, if you'd like to create a reseller without a domain, but with sudo access, please see our documentation.
Procedure
1. Create a user.
The easiest way to create a user is to create an additional cPanel user. If you choose this method, it will count towards your total cPanel users for licensing purposes, so you cannot use this method on a cPanel Solo server. You can also create a system (Linux) user with the adduser command.
2. Check the new user's shell
Ensure that the user is using a normal shell - like /bin/bash. You can determine what shell the user has by going to WHM » Manage Shell Access.
3. Add the user to the wheel group.
Once you have a username, you can go to WHM » Manage wheel group users and move the user you've just created into the wheel group. This step allows the user access to the sudo command.
4. Test access.
Ensure that the user you created can log in via ssh and use the command sudo su
with their password to gain root privileges. You can tell that the user has root privileges if the command whoami
returns "root".
The sudoers file: /etc/sudoers
This file determines what commands different users and groups may use.
If your wheel user can not use sudo to gain root access, make sure that this line exists in /etc/sudoers
%wheel ALL=(ALL) ALL
You should not edit the /etc/sudoers file directly but use the command visudo
to make changes. This command is documented in many places, including here.