扫码关注官方订阅号
我有私钥可以用,但是我只想输入密码。
注意不是服务端 sshd 的配置,是在客户端。 在 .ssh/id_rsa 存在的时候,我依然想用密码登陆。怎么办?
业精于勤,荒于嬉;行成于思,毁于随。
sshd_config中的PubkeyAuthentication设为no 另外你还可以把AuthenticationMethods设为publickey,password publickey,keyboard-interactive这样你就同时需要私钥和密码才能登录。
sshd_config
PubkeyAuthentication
no
AuthenticationMethods
publickey,password publickey,keyboard-interactive
具体设置看SSHD_CONFIG(5)
SSHD_CONFIG(5)
在客户端,你可以在~/.ssh/config文件里加入:
PreferredAuthentications password
注意不是=是空格
=
可以通过该命令:ssh -ND 4711 user@172.168.1.103 不过首先得确保远程机器 /etc/ssh/sshd_config 里 PasswordAuthentication yes 一般默认是开启的
ssh -ND 4711 user@172.168.1.103
/etc/ssh/sshd_config
PasswordAuthentication yes
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
sshd_config
中的PubkeyAuthentication
设为no
另外你还可以把
AuthenticationMethods
设为publickey,password publickey,keyboard-interactive
这样你就同时需要私钥和密码才能登录。具体设置看
SSHD_CONFIG(5)
在客户端,你可以在~/.ssh/config文件里加入:
注意不是
=
是空格可以通过该命令:
ssh -ND 4711 user@172.168.1.103
不过首先得确保远程机器
/etc/ssh/sshd_config
里PasswordAuthentication yes
一般默认是开启的