Question
How do you create sudo users?
Answer
A "sudo" user has similar permissions to the root account by default. You must create a "sudo" user if you wish to disable direct root logins.
How to disable direct root logins.
Additionally, if you'd like to create a reseller without a domain, but with sudo access, please see our documentation:
How to Create a WHM Reseller Without an Associated Domain | cPanel Docs
- Create a user.
- You can create a new cPanel account, though this will count towards your total cPanel users for licensing purposes:
Create a New Account | cPanel & WHM Documentation - Or you can use the
addusercommand to add a system user.
- You can create a new cPanel account, though this will count towards your total cPanel users for licensing purposes:
- Check the new user's shell
- Ensure the new user is set to use Normal Shell in WHM at Home / Account Functions / Manage Shell Access.
Manage Shell Access | cPanel & WHM Documentation
- Ensure the new user is set to use Normal Shell in WHM at Home / Account Functions / Manage Shell Access.
- Add the user to the wheel group.
-
In WHM, go to Home / Security Center / Manage Wheel Group Users and move the user you've just created into the wheel group.
Manage Wheel Group Users | cPanel & WHM DocumentationNote: This step allows the user access to the sudo command.
-
- Restart the SSH daemon.
- In WHM, go to Home / Restart Services / SSH Server (OpenSSH), and restart the SSH Daemon to ensure the updated user configuration is loaded.
- Test Access.
- Attempt to log in as your new user via SSH.
-
Once logged in, run the following and enter your password:
# sudo su
Note: By default, the prompt will change from $ to #.
-
Run the following, which the expected result should be
root:# whoami
If your wheel user cannot use the sudo command to gain root access, ensure the wheel group is permitted to use sudo:
# grep '%wheel' /etc/sudoers
This should contain:
CONFIG_TEXT: %wheel ALL=(ALL) ALL
You should not edit the /etc/sudoers file directly, but use the command visudo to make changes:
# visudo
Comments
0 comments
Article is closed for comments.