PVE创建的CT,Ubuntu系统,SSH无法登录的解决方法

默认分类 · 03-19 · 342 人浏览

无法SSH的问题是Ubuntu的安全选项问题,只需要修改ssh配置文件即可

在编辑之前,输入date获取一下时间、如果时间对不上则需要同步一下时区
sudo timedatectl set-timezone Asia/Chongqing

直接在PVE的控制台中编辑

nano /etc/ssh/sshd_config

修改 root登录
PermitRootLogin without-password
为
PermitRootLogin yes

修改 密码登录
PasswordAuthentication no
为
PasswordAuthentication yes

修改完过后保存退出

然后重启sshd
systemctl restart sshd

如还是无法连接,则需要重新安装SSH,执行以下命令选第一个
sudo apt-get install --reinstall openssh-server

重启sshd
systemctl restart sshd

然后大概率就可以连接了!

记一个创建新用户的命令
sudo adduser <用户名>

sudo usermod -aG sudo <用户名>

验证码:
Theme Jasmine by Kent Liao