我可以在USER@HOST
没有密码的情况下使用 ssh 登录服务器,但如果我输入ssh usdev
配置~/.ssh/config
如下所示的密码,则需要密码:
Host usdev
HostName HOST
User USER
IdentityFile /Users/USER/.ssh/id_rsa_us_east
这是 ssh usdev 的日志文件的一部分:
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/USER/.ssh/id_rsa_us_east RSA SHA256:xgKp1AxWfSaujfWqlJe3G4kUioRbuICDDJ2645VVVAs explicit
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: password
当你
ssh USER@HOST
,ssh 使用默认密钥。当你
ssh usdev
ssh 使用你的config
文件中指定的密钥。它们必须是不同的键。据我所知,默认情况下 ssh
~/.ssh/id_rsa
用作密钥。所以我猜这把钥匙是你的真正钥匙HOST
。