无法创建目录“/var/empty/.ssh”

dor*_*emi 8 ssh terminal bash macos

每天,在使用几个小时后,任何使用 SSH 的东西都会随机停止工作。唯一的解决方案是我重新启动我的机器,它会修复它,直到它再次随机发生。

> git push
Could not create directory '/var/empty/.ssh'.
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
Run Code Online (Sandbox Code Playgroud)

在尝试通过 ssh 进入 diff 主机后,这里有更多关于 -v 的信息(为了简洁而缩短):

debug1: Connection established.
Could not create directory '/var/empty/.ssh'.
debug1: identity file /var/empty/.ssh/id_rsa type -1
debug1: identity file /var/empty/.ssh/id_rsa-cert type -1
debug1: identity file /var/empty/.ssh/id_dsa type -1
debug1: identity file /var/empty/.ssh/id_dsa-cert type -1 
Run Code Online (Sandbox Code Playgroud)

我已登录到我的主要 OSX 用户。~/ 和 ~/.ssh 都很好而且完好无损,发生这种情况时我没有对我的用户的权限做任何事情。发生这种情况时,我当然不会在 /etc 中乱搞任何东西。

有什么我可以尝试帮助解决此问题以找出它为什么不断发生的方法吗?

小智 7

您是否使用 LDAP 支持的登录?您的机器可能已失去与 ldap 的连接,并以某种方式丢失了您的 HOME 属性。一位同事通过断开并重新连接他的网络而不是重新启动来“解决”这个问题。

烦人,但也许离问题的根本原因更近了一步。


小智 0

我不知道为什么会发生这种情况,但我用以下方法解决了这个问题:

sudo ln -s ~/.ssh /var/empty/.ssh
Run Code Online (Sandbox Code Playgroud)