linux系统刚安装完成后,ssh服务默认禁止root用户登录远程,需在配置文件 /etc/ssh/sshd_config中开启认证设置

PermitRootLogin yes           #允许root认证登录 
PasswordAuthentication yes   #允许密码认证

直接命令行执行命令即可

echo  "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo  "PasswordAuthentication yes" >> /etc/ssh/sshd_config
service sshd restart

或者执行

sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin yes/'  /etc/ssh/sshd_config
sed -i -e 's/^PasswordAuthentication.*$/PasswordAuthentication yes/'  /etc/ssh/sshd_config
service sshd restart
Logo

更多推荐