Disable SSH Root Login with Webmin

Today, I am going to disable SSH root log in of the Linux web server. Here’s what I am going to do now:

  • Force the use of SSH protocol 2, a newer and more secure SSH protocol.
  • Disable root direct log in.

Disable SSH Root Log in

1. Log in Webmin as root. The following screen will appear.

disable Root Login

2. Click the Others icon from the top menu, the window will be shown as the diagram below.

disable Root Login

3. Click the File Manager icon, the window will be shown as the diagram below.

disable Root Login

4. Find the sshd_config file at the following path:

/etc/ssh/sshd_config

disable Root Login

5. Click the Edit button from the menu bar, the following window will pop up.

disable Root Login

6. Find the following line:

Protocol 2, 1

Add the the following line to force using SSH Protocol 2:

Protocol 2

This is shown in the diagram below:

disable Root Login

7. Scroll down and find the following line:

PermitRootLogin yes

Add the following line not permit direct root login:

PermitRootLogin no

This is shown in the diagram below:

disable Root Login

8. Click on the “Save and Close” button to save the file.

9. Now, log in SSH as root and execute the following command to RESTART the SSH server:

/etc/rc.d/init.d/sshd restart

This is shown in the diagram below:

disable Root Login

10. Finished!

Now nobody can log in the Linux server as root. Anybody must first log in the server as admin and then switch to root by using the command ‘su –‘ if necessary.

You may also like...