Issue storing my SSH key and making it persistent

Ubuntu Version

26.04 LTS

Desktop Environment (if applicable)

XFCE

Problem Description

In the past, every time I closed a terminal and opened a new one to connect via SSH, the keys were still there persistently.

In Xubuntu 26.04, SSH keys are no longer stored persistently—I have to re-add them every single time I open a terminal.

I have edited your complaint to remove the irrelevant parts of your description, to remove the Code of Conduct violation, and to convert it into an answerable question.

3 Likes

I do not use Xubuntu on a regular basis, but I believe this was mentioned as a known issue:

If you follow the link perhaps there are workarounds you can apply.

Good luck!

2 Likes

Is this issue present in all flavors? I only use Xubuntu, but if it works in another edition, I’ll switch over to that one

Are you using SSH agent?

Show

ps -ef | grep ssh

and in both terminals

env | grep SSH

If you think I’m using an AI agent, the answer is no. I use the ssh-agent command, then ssh-add to add my SSH key and passphrase, but now after upgrading to Ubuntu 26.04 it’s not working.

It’s nothing to do with AI

How are you setting up the environment? I use SSH-agent and have lines in my ~/.bashrc to import the keys. Is this how you do it?

In a graphical session you shouldn’t be starting ssh-agent yourself, gnome-keyring-daemon is started at session startup and handles ssh-agent duties. It seems to be a little buggy if the keys are added by having “AddKeysToAgent” on in .ssh/config, so I always run ssh-add just after logging in, that seems to work.

The problem with starting ssh-agent yourself is it’s tied to the terminal session you started it in, so when you exit that the ssh-agent also goes away, taking the saved keys with it.

Starting ssh-agent yourself in a shell startup script like .profile or .bashrc used to work in the past, where graphical sessions were started by running a shell script and all the graphical applications were child processes of that. Now that graphical sessions are started via the systemd user process, the graphical applications are children of systemd instead.

# If we have an SSH key and keychain is installed then use it
if [ -x "$(command -v keychain)" ]; then
    eval $(keychain --eval --agents ssh id_rsa)
fi

Or whatever your private key is