ssh-copy-id 无法与 `~/.ssh/config` 一起使用

ssh-copy-id 无法与 `~/.ssh/config` 一起使用

我能够使用 ssh 登录到服务器USER@HOST而无需密码,但如果我输入则需要密码,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

答案1

当你 时ssh USER@HOST,ssh 使用默认密钥。
当你 时ssh usdev,ssh 使用文件中指定的密钥config。它们必须是不同的密钥。
据我所知,默认情况下 ssh 使用~/.ssh/id_rsa密钥。所以我猜那个密钥是你 的真正密钥HOST

相关内容