解决 Ubuntu 无法使用 root 用户进行 ssh 远程登陆

解决 Ubuntu 无法使用 root 用户进行 ssh 远程登陆

操作系统

Ubuntu 20.04.2 LTS

一、修改sshd配置文件

 //打开 /etc/ssh/sshd_config 配置文件
root@ubuntu:~# vim /etc/ssh/sshd_config
.......
Port 22      //取消前面的注释
.......
 //找到如下位置(大概在33行的位置)
.......
#LoginGraceTime 2m
PermitRootLogin yes       //取消该行前面的注释,将PermitRootLogin 后面的 without-password 改为 yes
StrictModes yes           //这一行可取消注释也可不取消,影响不大
#MaxAuthTries 6
#MaxSessions 10
.......

二、重启 sshd 服务

systemctl restart sshd

三、注意事项

1. 如果 PasswordAuthentication(禁止密码认证) 这一项是开启的,请将 no 改成 yes
原文地址:https://www.cnblogs.com/itwangqiang/p/14570603.html