# How To Disable Root SSH Login In WHM

> Here's how to disable root SSH logins using only the WHM interface. Once you've installed a file manager, the rest is easy.

- Author: [Bhagwad Park](https://www.namehero.com/blog/author/bhagwad-park/)
- Published: 2020-06-22
- Updated: 2020-06-22
- Category: [VPS Hosting](https://www.namehero.com/blog/category/vps-hosting/)
- Web page: https://www.namehero.com/blog/how-to-disable-root-ssh-login-in-whm/

If you haven’t already done so by now, read my earlier tutorial on [how to change your SSH port](https://www.namehero.com/blog/how-to-change-the-ssh-port-on-a-namehero-vps/) on a NameHero VPS. But that’s just the first step in hardening your server! There’s a lot more to be done. And probably the most important step is to disable root SSH logins. In this tutorial, I’ll explain how to achieve this in WHM when you first set up a NameHero VPS.

## Why Disable Root Logins?

Many reasons. For one, the “root” user is common across all installations, so it makes it that much easier for potential hackers to try and compromise your system when they already know one half of the equation – the username. But if you disable root logins, you don’t even allow them to get past the first step. Now they’ll need to guess the username as well.

But disabling root has another purpose – it forces you to log in as a user that doesn’t have complete control over the system. This means that a malicious script that insinuates itself into the system through you, won’t be able to have root access to the server. In general, it’s a good idea to get into the habit of not logging in as root. If you want to perform root actions, you’ll be able to temporarily elevate your privileges to get specific things done.

## Step 1: Ensure that You can Run Sudo Commands

Before disabling root login, you need to make sure that you can run administrative commands without root if necessary. Otherwise you’ll find that you can’t make any meaningful changes, and that you’ve locked yourself out of the system! Luckily, you can easily allow a user to run admin commands via “sudo”. Just follow my earlier tutorial on [how to use the “visudo” tool](https://www.namehero.com/blog/how-to-allow-a-linux-user-to-run-sudo-commands-with-namehero/) to safely add usernames to the list of accounts that are allowed to use sudo.

## Step 2: Install a File Manager in WHM

I’d mentioned in an earlier tutorial, that it’s best if you perform most actions from the command line. However, since this tutorial is about WHM, we’re going to have to install a file manager so that you can make the necessary changes.

Luckily, the same folks who provide the ConfigServer firewall plugin, have an excellent file manager utility. Installing it simple – just [execute these commands](https://download.configserver.com/cse/INSTALL.txt) on your server and you’ll find the new file manager plugin in WHM like this:
 ![Install the ConfigServer File Explorer](https://blogcdn.namehero.com/startup/wp-content/uploads/2020/06/22025954/Install-ConfigServer-Explorer-1024x558.png)Install the ConfigServer File Explorer

In the plugin section, just click the ConfigServer Explorer icon to enter the file manager.

## Step 3: Modify the sshd_config File

Once you open the file explorer, navigate to the following file:

```
/etc/ssh/sshd_config
```

As shown here:
 ![Find the sshd_config File](https://blogcdn.namehero.com/startup/wp-content/uploads/2020/06/22030014/Open-ssh_config-1024x581.png)Find the sshd_config File

Click the “Edit” button on the right-hand side. This will open up the file for editing. Scroll down until you find the following line:

#PermitRootLogin yes
 ![Find the PermitRootLogin Line](https://blogcdn.namehero.com/startup/wp-content/uploads/2020/06/22030023/Find-the-Permit-Root-Login-Line-in-sshd_config-1024x426.png)Find the PermitRootLogin Line

Remove the hash (#) at the beginning of the line, and change “yes” to “no” like this:
 ![Uncomment the Line to Disable Root Logins](https://blogcdn.namehero.com/startup/wp-content/uploads/2020/06/22030027/Disable-Root-Login-1024x398.png)Uncomment the Line to Disable Root Logins

Then save your changes.

## Step 4: Restart the SSH Service

Once you’re done, restart the SSH service by searching for it in the WHM box on the left-hand side. Select the “SSH Server (OpenSSH) line item at the bottom and confirm that you want to restart the service like this:
 ![Restart SSH](https://blogcdn.namehero.com/startup/wp-content/uploads/2020/06/22030030/Restart-the-SSH-Service-1024x852.png)Restart SSH

Wait for the service to restart, and you’re done. You have now successfully disabled root logins on your NameHero VPS!

## Related posts

- [How To Disable Root Logins On Linux](https://www.namehero.com/blog/how-to-disable-root-logins-on-linux/)
- [Using SSH Keys to Login to Your VPS – Part II](https://www.namehero.com/blog/using-ssh-keys-to-login-to-your-vps-part-ii/)
- [Using SSH Keys to Login to Your VPS – Part I](https://www.namehero.com/blog/using-ssh-keys-to-login-to-your-vps-part-i/)
- [How To Safely Disable Root Access On InterWorx](https://www.namehero.com/blog/how-to-safely-disable-root-access-on-interworx/)
