How to allow root user SSH login in Linux

In some Linux distributions, SSH root login is disabled by default . The root user login is controlled by the PermitRootLogin command in the openssh-server configuration ( sshd_config file) :

You can check the current status by running the following command:

grep -i "rootlogin" /etc/ssh/sshd_config

If the PermitRootLogin instruction has been commented out (the preceding #) or its value is not set to yes , then root login is disabled .

If you want to enable ssh root login, perform the following steps with root privileges:

Open /etc/ssh/sshd_config :

vim /etc/ssh/sshd_config

Uncomment the PermitRootLogin line and set its value to yes :

PermitRootLogin yes

To make the new settings take effect, restart the ssh server:

systemctl restart sshd.service

Now that we have enabled ssh root login, you can try ssh with the root user on the remote computer

 

Guess you like

Origin blog.csdn.net/allway2/article/details/108815503