SSH 自动登录对一个用户有效,但对另一个用户无效

SSH 自动登录对一个用户有效,但对另一个用户无效

我想使用以下方式启用自动 ssh 登录.ssh/配置文件为我的git用户。

这是我的.ssh/配置文件:

Host test
    HostName myserver.net
    User test
    IdentityFile ~/.ssh/id_rsa

Host git
    HostName myserver.net
    User git
    IdentityFile ~/.ssh/id_rsa

它适用于我的测试用户但不是我的git用户所以我的全局 SSH 配置是正确的。

据我所知,配置完全相同。它曾经与git用户,但我不知道是什么改变破坏了自动登录。

当我输入:

ssh -v git

我收到以下日志:

...
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
Offering RSA public key: /Users/mylocalusername/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
[email protected]'s password: _

有谁知道可能存在什么区别

答案1

检查日志服务器看看为什么它不接受用户的密钥。您可能需要将日志级别更改sshd_config

LogLevel DEBUG

然后重新启动sshd

相关内容