Create SUDO user in cPanel

[Total: 4    Average: 5/5]

Root user has full system access and should be used only for administrative tasks. There are basically no restrictions on what you can do to your system as the root user, which is powerful, but extremely dangerous. Linux does not have an “undo” button.

If you want to disable direct SSH login as root for security reason then you can create sudo user in cpanel.

The first step is to add a new user. New users, by default, are unprivileged. This means that they will only be able to modify files in their own home directory, which is what we want. Login to server as root and create user using below steps :

useradd sshadmin
passwd sshadmin

Now add this user to wheel group from WHM. The wheel group is a legacy from UNIX. When a server had to be maintained at a higher level than the day-to-day system administrator, root rights were often required. The ‘wheel’ group was used to create a pool of user accounts that were allowed to get that level of access to the server. If you weren’t in the ‘wheel’ group, you were denied access to root.

WHM –> Security Center –> Manage Wheel Group Users

Open /etc/ssh/sshd_config and set

PermitRootLogin no

Restart the ssh service

/etc/init.d/sshd restart

Now you can ssh to server as user sshadmin and run the command “su -” to switch to root user.