Location of socket for agent forwarding on remote machine configurable?

Roumen Petrov openssh at roumenpetrov.info
Fri Aug 15 17:18:32 AEST 2025


На 14.08.25 г. в 14:52, Nils Rennebarth написа:
> Hi,
> 
> [SNIP]
> 
> Is it possible to configure the location of the agent socket on the 
> remote machine, or is that location hardcoded to /tmp/ssh-XXXXXXXXXXXX/ 
> agent.<pid>?

This depend from view point.
One group of developers prefer hard-coded values, for instance:
a) OpenSSH
$ fgrep /tmp/ *.c
auth-krb5.c:        "FILE:/tmp/krb5cc_%d_XXXXXXXXXX", geteuid());
misc.c: r = snprintf(s, len, "/tmp/ssh-XXXXXXXXXXXX");
session.c:      auth_info_file = xstrdup("/tmp/sshauth.XXXXXXXXXXXXXXX");
$ fgrep TMPDIR *.c
misc.c: if ((tmpdir = getenv("TMPDIR")) != NULL) {
ssh-agent.c:                     * in $TMPDIR.


Others like my prefer to avoid hard-coded values, for instance:
b) PKIX-SSH
$ fgrep TMPDIR *.c
auth-krb5.c:{   const char *tmpdir = getenv("TMPDIR");
misc.c: * environment variable TMPDIR.
misc.c: tmpdir = getenv("TMPDIR");
misc.c: if ((tmpdir = getenv("TMPDIR")) != NULL) {
session.c:      COPY_ANDROID_ENV("TMPDIR");

with fail back to /tmp.
$ fgrep /tmp/ *.c
misc.c: r = snprintf(s, len, "/tmp/ssh-XXXXXXXXXX");

Side effect daemon could be run in Android application.


> 
> [SNIP]
> 
> Best regards, Nils


Roumen


More information about the openssh-unix-dev mailing list