I faced a strange problem.
Give: 2 Debian 12, same updates done.
When i create a ssh-agent with
ssh-agent -a ~/.ssh/my-agent -t 7200
i get a ssh-agent process and a socketfile ~/.ssh/my-agent
then i
I asked on stackoverflow for my problem.
And i will ask here too…
I start for every connection-group an own ssh-agent with different ssh-keys in it.
And i connect from my laptop sometimes (regulary) to my desktop-machine and forward the agent to the desktop. This is a setup, i need.
And i have a script, which chooses from ssh config, (Match section) the ssh-agent i need for this connection-group.
This script starts automatically an ssh-agent and loads the identities (private-keys, hardware-token…) into this ssh-agent and per configfile it is choosen as IdentityAgent.
When i’m connected to my desktop with my laptop and i work on my desktop, then i use the forwarded agent, because i have some keys only on my laptop, which i want to use also from my desktop. So i link the forwarded agent-socket to the IdentityAgent, which is configured in ssh-config for this connection…
When there is no forwared ssh-agent, the symlink is deleted and a new agent is started with a socketfile on the same path.
It sound’s a bit complicated… and yes, it is.
An i don’t get it, why sometimes the socketfile is deleted and sometimes it remains.
Now i tested it from home on the remote-connection. The temporary, forwarded agent-socket is a symlink to my regular socket-file. and i killed the running ssh-agent… and also the symlink is removed.
It is strange behaviour… a process unlinks a socket-file, which does not belong to him, only the name is the same… and not every time.
I expect, it deletes the socket, which on which the process is listening.
what if i rename the socket (for some reason). Then the socketfile should be deleted also.
I start for every connection-group an own ssh-agent with different ssh-keys in it. And i connect from my laptop sometimes (regulary) to my desktop-machine and forward the agent to the desktop. This is a setup, i need.
And i have a script, which chooses from ssh config, (Match section) the ssh-agent i need for this connection-group. This script starts automatically an ssh-agent and loads the identities (private-keys, hardware-token…) into this ssh-agent and per configfile it is choosen as IdentityAgent.
When i’m connected to my desktop with my laptop and i work on my desktop, then i use the forwarded agent, because i have some keys only on my laptop, which i want to use also from my desktop. So i link the forwarded agent-socket to the IdentityAgent, which is configured in ssh-config for this connection… When there is no forwared ssh-agent, the symlink is deleted and a new agent is started with a socketfile on the same path.
It sound’s a bit complicated… and yes, it is.
An i don’t get it, why sometimes the socketfile is deleted and sometimes it remains. Now i tested it from home on the remote-connection. The temporary, forwarded agent-socket is a symlink to my regular socket-file. and i killed the running ssh-agent… and also the symlink is removed.
It is strange behaviour… a process unlinks a socket-file, which does not belong to him, only the name is the same… and not every time.
That is what I would expect it to do actually. I would expect it to close the socket it has open and the delete (unlink) it by name.
I expect, it deletes the socket, which on which the process is listening. what if i rename the socket (for some reason). Then the socketfile should be deleted also.
Directory operations like unlinking (deletion) traditionally work via paths, not open file handles.