How to enable root user to log in directly with ssh?

 

question
For security reasons, the default parameters are very strict. It is forbidden for root users to directly use ssh to log in . For
example, use a non-root account first. After logging in to ssh, su becomes root.

 

solution
If you want to log in directly with root, modify the following configuration file:
vi /etc/ssh/sshd_config

Find the following line, remove the # symbol in front, and modify no to yes
#PermitRootLogin no
to:
PermitRootLogin yes

Next, execute the following Command to restart the SSH service:
xxx# /etc/rc.d/sshd restart
Stopping sshd.
Waiting for PIDS: 349.
Starting sshd.
xxx# 

After the restart is complete, ssh can log in

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326969268&siteId=291194637