How to disable SSH login for the root user?

Open the main ssh configuration file /etc/ssh/sshd_config with your select of editor.

# vi /etc/ssh/sshd_config
#PermitRootLogin no
Remove the ‘#‘ from the start of the line.  Make the line look like similar to this.

PermitRootLogin no
Next, we need to restart the SSH daemon service.
# /etc/init.d/sshd restart
Try to login with root user, you will get “Access Denied” error.

So, from now onwards login as normal user and then use ‘su’ command to shift to root user.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

List of Common Available Ports On Cloud And VPS Servers

Inside our Cloud and VPS hosting services we want to make assured our clienteles have the skill...

Cloud Hosting VS. Shared Hosting

Shared hosting is the general hosting solution. But using a shared hosting solution user has to...

How to block IP using .htaccess file?

1) You may block entrance to your website from particular IP addresses using .htaccess file.2)...

How to Delete a cPanel Account From SSH

You can also terminate an account using SSH/command line if wanted using the following script....

How to Delete a cPanel From WHM

Eliminating an existing cPanel account is a very fast and easy process, but be advised this move...