Ubuntu 22.04 SSH 设置

允许 root ssh 登录

# 给 root 设置密码
passwd root

# 修改配置
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ori

vi /etc/ssh/sshd_config
PermitRootLogin yes

# 重启 sshd 服务
systemctl restart sshd

开启秘钥认证和关闭密码认证

注意事项,可以先开启秘钥认证,秘钥认证成功后再关闭密码认证,以防秘钥认证失败无法使用密码登录

vi /etc/ssh/sshd_config
# 修改下面
PubkeyAuthentication yes
PasswordAuthentication yes # !!! 秘钥认证成功后再改成 no,关闭密码认证

# 在最后添加
PubkeyAcceptedAlgorithms +ssh-rsa

# 确保 /etc/ssh/sshd_config.d/*.conf 下没有额外的配置,有则删除

# 重启 sshd 服务
systemctl restart sshd
posted @   klvchen  阅读(1928)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
点击右上角即可分享
微信分享提示