错误的配置选项:Identityfile



我的ssh配置是好的,它工作得很好,但是最近我的Github ssh连接不起作用,我也无法使用ssh连接连接到我的私人服务器。当我尝试ssh时,我得到以下错误:

/home/hacku/.ssh/config: line 9: Bad configuration option: Identityfile
/home/hacku/.ssh/config: line 16: Bad configuration option: Identityfile
/home/hacku/.ssh/config: terminating, 2 bad configuration options

下面是我的配置文件:

Host github.com
User git
Port 22
Hostname github.com
IdentityFile ~/.ssh/github_ssh
TCPKeepAlive yes
Host linode
HostName serv_ip_address
User hackU
Port 22
IdentityFile ~/.ssh/private_key

我复制了完全相同的配置文件和我的私钥到另一台机器,它工作得很好(Termux, ssh版本=>OpenSSH_8.6p1, OpenSSL 1.1.1 24 Aug 2021).

我检查了我的ssh包版本,它是OpenSSH_8.7p1,所以我想可能是更新破坏了它。所以我把它降级到OpenSSH_8.6p1, OpenSSL 1.1.1.1 24 Aug 2021,它也不起作用,另外我试图通过使用

重新启动sshdsudo systemctl restart sshd

但以上都不起作用。

我使用manjaro gnome版本作为我的日常驱动程序。

事先谢谢。

理论上一切似乎都很好,但事情是,它奇怪地抛出这个错误。在做了一些阅读之后,我在这里找到了这个信息:

如果您使用ssh-agent, ssh将自动尝试使用代理中的密钥,即使您没有在ssh_config的IdentityFile(或-i)选项中指定它们。这是您可能遇到"用户错误导致身份验证失败太多"的常见原因。使用IdentitiesOnly yes选项将禁用此行为。

所以我完全删除了IdentityFile选项。因此,我的最终配置文件是这样的,两个连接工作正常。

Host github.com
User git
Port 22
Hostname github.com
TCPKeepAlive yes
Host linode
HostName server_ip_address
User hackU
Port 22

然而,问题的原因对我来说仍然是未知的。我很乐意听到,以防被人发现。

最新更新