strange folder in /tmp with name ssh-*
while i do ls
to the /tmp i found these files
what is the meaing of the ssh folder i found
/tmp$ ls
config-err-pBxjic
e5a28b00f2378661cc615788a1fef225-{87A94AB0-E370-4cde-98D3-ACC110C5967D}
gnome-software-TQ809Y
ssh-Rony2Zd8gQ6O
systemd-private-a789ca0968fb4855b28539acfbf9babe-colord.service-UCNgBR
systemd-private-a789ca0968fb4855b28539acfbf9babe-fwupd.service-4Xkw4W
systemd-private-a789ca0968fb4855b28539acfbf9babe-rtkit-daemon.service-KmLgj9
systemd-private-a789ca0968fb4855b28539acfbf9babe-systemd-resolved.service-F55I3N
systemd-private-a789ca0968fb4855b28539acfbf9babe-systemd-timesyncd.service-W5W5Kx
unity_support_test.0
/tmp$ cd ssh-Rony2Zd8gQ6O/
/tmp/ssh-Rony2Zd8gQ6O$ ls
agent.1616
/tmp/ssh-Rony2Zd8gQ6O$ cat agent.1616
cat: agent.1616: No such device or address
so what is the meaning of the existence of this folder and it's content
Solution 1:
The folder contains sockets used by programs to communicate with ssh-agent:
From the man page:
$TMPDIR/ssh-XXXXXXXXXX/agent.< ppid >
UNIX-domain sockets used to contain the connection to the
authentication agent. These sockets should only be readable by
the owner. The sockets should get automatically removed when the
agent exits.
Solution 2:
Florian's answer is correct. However, if you find a lot of them building up, you can put this file in your $HOME/.bash_logout file:
[ -n "$SSH_AGENT_PID" ] &&
ps -p "${SSH_AGENT_PID}" >/dev/null 2>&1 | grep ssh-agent &&
kill "${SSH_AGENT_PID}"
I'm not sure if they remain due to a bug, or if that's how ssh-agent is designed. But on some of our systems we see old ssh-agent processes left running and those files left under /tmp. Killing the agent process should remove the /tmp/ssh-whatever directory and files, but if it doesn't on your system, you could add a line to check and remove it based on $SSH_AUTH_SOCK.