Skip to content
Related Articles

Related Articles

How to Disable SSH Root Login in Linux?
  • Difficulty Level : Medium
  • Last Updated : 17 Mar, 2021

SSH or secure shell is a network protocol established between two computers on a network to communicate with each other and share data. This protocol is useful in the case of remote access to the machine. SSH makes the work easy and accessible anywhere. Here we will see how to disable SSH Root Login in Linux.

Installation of Openssh-server and Openssh-client 

The client version is installed on the system if the requirements are only to connect to any available server over the network.

#sudo apt install openssh-client
How to Disable SSH Root Login in Linux

openssh-client installation

The server version is installed on the system if the requirement is to make the system available to different ssh clients all over the network.

#sudo apt install openssh-server
How to Disable SSH Root Login in Linux

openssh-server installation

Edit SSH access

Check the status of ssh server:

# sudo service ssh status
How to Disable SSH Root Login in Linux

ssh status

Disable root ssh login:

# sudo gedit /etc/ssh/sshd_config

open config file command

The configuration file:



How to Disable SSH Root Login in Linux

Permission is password protected

Change this “prohibited-password” to “no“:

How to Disable SSH Root Login in Linux

Permit no

Now save the file and restart the ssh service using the below commands:

# service ssh restart

restart ssh service

Now you have successfully disabled the accessibility of root via ssh protocol.

My Personal Notes arrow_drop_up
Recommended Articles
Page :