Celebrate Our 22nd Anniversary with Huge Savings! Up to 70% Off

How to Disable SSH Login for the Root User in Linux?

Please refer to the steps below to disable root login using SSH in Linux. 

1. Log in to your Linux Server via console or sudo user.

2. Use your preferred browser to open the sshd_config file from the /etc/ssh/ location. 

vi /etc/ssh/sshd_cofig

3. Change the Permit Root login to sshd_config and save the file

After modifying the files, you need to restart the ssh service to apply the changes. 

4. Enter the following service to restart the ssh service.

# systemctl restart sshd

 

Looking to change the SSH port on Ubuntu?
    Please refer to the article on Changing the SSH port on Ubuntu for more details.

 


Was this answer helpful?

« Back

chat