Take the 2-minute tour ×

Every day, after several hours of use, anything using SSH will just randomly stop working. The only solution is for me to restart my machine, which fixes it until it randomly occurs again.

> git push
Could not create directory '/var/empty/.ssh'.
The authenticity of host 'github.com (' can't be established.

Here's more info with -v (shortened for brevity) after trying to ssh into a diff host:

debug1: Connection established.
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 

I'm logged into my main OSX user. ~/ and ~/.ssh are both fine and intact and I'm not doing anything to the permissions of my user when this happens. I'm certainly not messing around with anything in /etc when this happens.

Is there anything I can try to help troubleshoot this to figure out why it keeps happening?

share|improve this question
What is the output of ls -l /var/empty? –  8bittree Feb 25 at 21:19
What happens when you manually create the .ssh directory in /var/empty. You can use chown -R USERNAME /var/empty/.ssh to change the ownership to your account. –  kobaltz Feb 25 at 21:20
ls -l /var/empty returns nothing. @kobaltz It works until ssh needs my key and then it fails because it can't find them in /var/empty/.ssh. I could move them, but that doesn't tell me what the underlying issue is. –  doremi Feb 25 at 21:52
Right, this would probably work better if I asked about the right command. What does stat -f "%Sp" /var/empty say? –  8bittree Feb 25 at 22:07
drwxr-xr-x, but I think /var/empty is red herring for the root issue which is why does ssh stop using my home dir's .ssh and begin looking in a different place. –  doremi Feb 25 at 22:13

3 Answers 3

Are you using an LDAP-backed login? It's possible your machine has lost connection to the ldap and somehow lost your HOME attribute. A coworker 'got around' this by disconnecting and reconnecting his network, instead of a reboot.

Annoying, but perhaps a step closer to the root cause of the issue..

share|improve this answer

You should perhaps change the $HOME enviroment variable from /var/empty to /Users/username.

export HOME="/Users/your-username"

should do the trick.

share|improve this answer

I don't know why this happens, but I got around it with:

sudo ln -s ~/.ssh /var/empty/.ssh
share|improve this answer

Your Answer


