NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ssh-agent on 32-bit NetBSD?



On Sun, 22 Nov 2026, Ted Spradley wrote:

I've had this in my .profile on my amd64 and aarch64 systems for years:

sagent(){
   [ -S "$SSH_AUTH_SOCK" ] || export SSH_AUTH_SOCK="$(< ~/.ssh/ssh-agent.env)"

   # if cached agent socket is invalid, start a new one
   [ -S "$SSH_AUTH_SOCK" ] || {
       eval "$(ssh-agent)"
       ssh-add
       echo "$SSH_AUTH_SOCK" > ~/.ssh/ssh-agent.env
   }
}

sagent

It works fine on the console, under X11 & xdm, and ssh. Recently I've
resurrected some old 32-bit machines, an i386 (eeePC 900) and an armv7
(raspberrypi 2B), and on those machines I get an error:

ksh: /home/tsprad/.profile[50]: /home/tsprad/.ssh/ssh-agent.env: cannot
open $() input


If the file in `$(<...)' doesn't exist, then this ksh stops processing the rest
of the script:

```
qemu$ cat x.sh
X=$(</non-existent)
echo XXX

qemu$ ksh x.sh
x.sh[1]: /non-existent: cannot open $() input

qemu$ sh x.sh
x.sh: cannot open /non-existent: no such file
XXX

qemu$
```

so, the `~/.ssh/ssh-agent.env' file is never created. Change that 1st test to:

```
[ -f ~/.ssh/ssh-agent.env ] && export SSH_AUTH_SOCK="$(<~/.ssh/ssh-agent.env)"
```

I should mention I use /bin/ksh, have done for decades.
[...]
is the problem. Both echoes show $SSH_AUTH_SOCK as blank. The test for
a socket works as expected on 64-bit but not on 32-bit.


This one is not a 32-bit issue... however, the latest NetBSD/i386 10.2_STABLE's
sshd does segfault, consistently--at least in my QEMU instance.

-RVP


Home | Main Index | Thread Index | Old Index