服务器如何取消密钥登录?
美国、香港服务器
服务器如何取消密钥登录?
03-17 来源:
一、1 分钟恢复密码登录(取消密钥)
1. 编辑 SSH 配置
bash
运行
nano
/etc/ssh/sshd_config
2. 找到并修改这 2 项
把:
plaintext
PasswordAuthentication no
改成:
plaintext
PasswordAuthentication yes
确保:
plaintext
PubkeyAuthentication yes
(不改也行,保留密钥也能用,只是同时允许密码登录)
3. 重启 SSH 服务生效
bash
运行
systemctl restart sshd
二、如果你想 彻底关闭密钥、只留密码
再把这一项改成:
plaintext
PubkeyAuthentication no
然后重启 SSH:
bash
运行
systemctl restart sshd
三、最简单记忆版
• 允许密码登录:PasswordAuthentication yes
• 关闭密码登录:PasswordAuthentication no
• 修改完 必须重启 sshd
三二互联专业提供香港VPS,美国VPS主机,香港云服务器租用等业务香港美国到大陆CN2 GIA速度最快