Hey all,

I just tested using ssh-agent to remember passphrases and wanted to share a
minimalist setup in case anyone is interested. This was being discussed in
another thread but things veered way off course so I wanted to provide a
cleanroom example using Slackware (which is the OS of choice in the other
thread).

Slackware ships with XFCE and if this is what you are using then ssh-agent
is run by the desktop environment with no additional effort needed. KDE
and CLI examples are out-of-scope for this POC.

To test this functionality, I created a temporary key with a passphrase
called "id_passphrase_test". I'm assuming the reader knows how to copy an
ssh key to their remote host, but in this example I'm using certs for my
internal domain. This should not affect whether or not ssh-agent remembers
my passphrase.

The first step is to verify that the key works and that the user is
prompted for it every time they attempt to ssh into the host. The user will
be prompted with the text "Enter passphrase for key". This is how you know
that you are entering the key passphrase, not the password for the remote
host.

2) I verify that no keys are loaded into ssh-agent using 'ssh-add -l'.

3) you add your PRIVATE key to the agent using
ssh-add /path/to/id_passphrase_test. The user will be prompted for their
passphrase.

4) Verify that it has been loaded via ssh-add -l.

5) log into the remote host. Note the lack of prompt for passphrase.

The following is terminal output where I used a passphrased key to ssh from
host cesium to zinc using ssh-agent. Note how it goes from asking for my
passphrase to not asking for my passphrase.

[begin terminal output]
slvnt@cesium:~$ ssh zinc
Enter passphrase for key '/home/slvnt/.ssh/id_passphrase_test':
Last login: Wed Nov 25 09:57:04 2026 from 192.168.3.102
Linux 7.0.6.

If a train station is a place where a train stops, what's a workstation?

bkoenig@zinc:~$ exit
logout
Connection to zinc closed.

# try again, it asks for passphrase a second time meaning it was not cached
slvnt@cesium:~$ ssh zinc
Enter passphrase for key '/home/slvnt/.ssh/id_passphrase_test':
Last login: Wed Nov 25 09:57:18 2026 from 192.168.3.102
Linux 7.0.6.

It doesn't much signify whom one marries, for one is sure to find out
next morning it was someone else.
-- Rogers

bkoenig@zinc:~$ exit
logout
Connection to zinc closed.
slvnt@cesium:~$ ssh-add -l
The agent has no identities.
slvnt@cesium:~$ ssh-add ~/.ssh/id_passphrase_test
Enter passphrase for /home/slvnt/.ssh/id_passphrase_test:
Identity added: /home/slvnt/.ssh/id_passphrase_test (slvnt@****)
Certificate added: /home/slvnt/.ssh/id_passphrase_test-cert.pub (bkoenig@****)
slvnt@cesium:~$ ssh-add -l
256 SHA256:/VAagfQjnhzQY0Fo9zxJXifiaidRKNeBPZoxFjzkrCo slvnt@**** (ED25519)
256 SHA256:/VAagfQjnhzQY0Fo9zxJXifiaidRKNeBPZoxFjzkrCo slvnt@**** (ED25519-CERT)
slvnt@cesium:~$ ssh zinc
Last login: Wed Nov 25 09:57:33 2026 from 192.168.3.102
Linux 7.0.6.

Neutrinos have bad breadth.

bkoenig@zinc:~$
[end terminal output]

On an system running Slackware+XFCE this should work using the same
sequence of steps. If it fails then it probably means the user has customized
something in a way that is not compatible with ssh-agent. The question there
would be something like "what change did I make that upset ssh-agent?"

Now that I have arrived at my workstation via ssh I am going to stop working.
-Ben

Reply via email to