51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Linux 开启密钥登录后保留密码登录的方法

Linux 开启密钥登录后保留密码登录的方法

在启用密钥登录后,默认关闭密码登录,可提高服务器的安全性。但通过以上方式,可以保持密钥与密码的双重登录方式。

1-

vi /etc/ssh/sshd_config 

2、修改参数

找到 #Authentication 部分,将 PasswordAuthentication 参数修改为 yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no

若 sshd_config 配置文件中无此配置项,则添加 PasswordAuthentication yes 项即可。

3、重启服务
输入命令重启 sshd 服务,重启后,可使用密码进行登录。

systemctl restart sshd
赞(1)
未经允许不得转载:工具盒子 » Linux 开启密钥登录后保留密码登录的方法