#620457 Please move /tmp/ssh-XXXXXXXXXXXX directories to $XDG_RUNTIME_DIR

Package:
openssh-client
Source:
openssh
Description:
secure shell (SSH) client, for secure access to remote machines
Submitter:
Josh Triplett
Date:
2026-05-14 11:33:02 UTC
Severity:
normal
Tags:
#620457#3
Date:
2011-04-01 23:47:22 UTC
From:
To:
ssh-agent creates $SSH_AUTH_SOCK within a temporary directory of the
form /tmp/ssh-XXXXXXXXXXXX.  These directories often stick around and
don't get cleaned up.  (Right now I have piles of them just from the
past month.) These directories seem like a perfect fit for /var/run,
rather than /tmp, since they exist primarily to provide a socket.
Moving them to /var/run should not break anything (since $SSH_AUTH_SOCK
would point to the new location), and should allow these directories to
get automatically cleaned up.  Furthermore, this reduces clutter in
/tmp.

Thanks,
Josh Triplett

#620457#10
Date:
2011-04-02 08:14:02 UTC
From:
To:
retitle 620457 Please move /tmp/ssh-XXXXXXXXXXXX directories to $XDG_RUNTIME_DIR
unblock 620457 with 620458
thanks

A conversation with Michael Biebl turned up $XDG_RUNTIME_DIR, which
provides a much better fit than /var/run, not least of which because it
already has the appropriate permissions for users to create files in it.

- Josh Triplett

#620457#21
Date:
2015-12-15 19:20:29 UTC
From:
To:
This was fixed upstream in 5.9.
#620457#26
Date:
2015-12-15 20:12:03 UTC
From:
To:
Hello:

Please note that XDG_RUNTIME_DIR might be not set on some headless computers:
TMPDIR (and such) [see #619760] might be honour first instead.
Having said that, there exists packages that allows to clean up
the temporary directories (e.g., tmpreaper).

Jerome

#620457#31
Date:
2015-12-16 09:34:38 UTC
From:
To:
Control: reopen 620457

No.  The upstream bug is CLOSED INVALID, with upstream arguing that
TMPDIR is sufficient but not replying to the objection raised against
that.

#620457#40
Date:
2026-04-18 14:48:26 UTC
From:
To:
Removed 10s of /tmp/ssh-XXXXXXXXXXXX manually today.
My /tmp is a regular directory, not tmpfs, I guess it is the reason why i still suffer of this bug.
Regular systemd's cleanup of /tmp is enabled but these directories are explicitly excluded from it by /usr/lib/tmpfiles.d/openssh-client.conf
Maybe just remove it from the package?

#620457#45
Date:
2026-05-14 11:32:07 UTC
From:
To:
https://salsa.debian.org/ssh-team/openssh/-/commit/015918425f1af02029f393ec1972de4d61f60a8d
describes why that tmpfiles.d entry is present.  I don't think any of
those reasons have changed, and so simply removing that entry would have
the consequences described in the first paragraph of that commit
message.