可以通过该命令:ssh -ND 4711 user@172.168.1.103
不过首先得确保远程机器 /etc/ssh/sshd_config
里 PasswordAuthentication yes
一般默认是开启的
sshd_config
中的PubkeyAuthentication
设为no
另外你还可以把AuthenticationMethods
设为publickey,password publickey,keyboard-interactive
这样你就同时需要私钥和密码才能登录。
具体设置看SSHD_CONFIG(5)
在客户端,你可以在~/.ssh/config文件里加入:
PreferredAuthentications password
注意不是=
是空格