recover ssh-agent socket
Yedidyah Bar David
linux-il at didi.bardavid.org
Sun Jan 9 10:13:54 IST 2022
On Sun, Jan 9, 2022 at 8:11 AM Daniel Shahaf <d.s at daniel.shahaf.name> wrote:
>
> Tzafrir Cohen wrote on Sat, 08 Jan 2022 09:06 +00:00:
> > I accidentally deleted my ssh-agent's socket from /tmp. The agent is
> > still running and I have $SSH_AGENT_PID and $SSH_AUTH_SOCK set in
> > various processes, so I know where it should have been.
> >
> > Is there any way to recover the socket? Short of restarting the X
> > session, of course.
>
> Could you just spawn a new ssh-agent instance and have it use
> $SSH_AUTO_SOCK as the name of the socket, and re-add private keys to it?
> $SSH_AGENT_PID would still point at the old instance, sure, but what
> would that break?
In the past, I did something similar, which partially worked - I started a new
ssh-agent with its defaults, and linked the newly-created socket to the old
location.
Actually what I did was in a slightly different flow - I had my X session killed
for some reason, but had screen/tmux sessions in the background. I logged
in again to a new X session, attached the screen/tmux's, and wanted to be
able to start X clients/windows from shells there.
I don't remember anymore what didn't work perfectly, but I do remember
that I eventually closed the old screen/tmux's and started new ones, due
to some annoyances I didn't bother debugging further.
Good luck,
--
Didi
More information about the Linux-il
mailing list