El Capitan – ssh-agent / screen sessions lost

After an upgrade to OSX 10.11.1 (El Capitan) I’ve had a number of issues with ssh-agent and screen sessions being lost after being open for a few days. The socket file in /var/folders was removed and the screen session became unusable and the ssh-agent session was also lost.

In El Capitan, the screen socket is stored in a temporary location like

/var/folders/7k/xxxxxx...xxx/T/.screen/xxx

I believe the issue is that OSX or a utility is cleaning files here inappropriately.

My temporary fix is to set the ssh-agent and screen socket directory to a location in my home directory, ie:

export SCREENDIR=~/.screen
chmod 700 ~/.screen
mkdir ~/.ssh-agent
chmod 700 ~/.ssh-agent
ssh-agent -a ~/.ssh-agent/agent.pid screen

This solution appears to work.

Leave a Reply

Your email address will not be published. Required fields are marked *