Skip to main content
edited tags
Link
muru
  • 77.9k
  • 16
  • 212
  • 317
edited tags
Link
Became Hot Network Question
Source Link

Why is ssh-agent ignoring the lifetime in .ssh/config?

I can't get ssh-agent to work like I want to. It keeps removing the saved identities on reboot.

I use AddKeysToAgent in my .ssh/config like this:

AddKeysToAgent 30w

That's the top of the file, followed by Host definitions. I also tried it like this

Host *
  AddKeysToAgent 30w

with no success.

My identities are remembered when I ssh to a server as intended. They are remembered when I close the terminal and open it again, but they are lost when I reboot. I can use ssh-add -l to see them or verify there are no identities saved after a reboot.

There is only one ssh-agent running. It is started from .bashrc like this:

if ! pgrep -u "$USER" ssh-agent > /dev/null; then
    ssh-agent > "/home/deck/.ssh-agent.env"
fi
if [ ! -f "$SSH_AUTH_SOCK" ]; then
    source "/home/deck/.ssh-agent.env" >/dev/null
fi

As mentioned, it works. It just ignores the lifetime defined in .ssh/config.

What could be the reason? Are there any max values, defaults, overrides? Is there some master setting that says "on reboot kill all"?

This is on SteamOS, an Arch-derived OS that comes with KDE Plasma.

SSH -V: OpenSSH_9.9p1, OpenSSL 3.4.0 22 Oct 2024