SSH key pair location---where are keys saved?

Running TrueNAS Scale Cobia Release

I feel like I’m missing something obvious, but I cannot find my key pairs that are generated in the web GUI (Credentials → Backup Credentials → SSH Keypairs). I just generated a new pair (logged in as user admin) and there’s nothing in:

~/.ssh (other than known_hosts)
/root/.ssh (other than known_hosts)

Where are the keys stored? I’d like to write a cron job script that uses ssh to connect to another server, and when I try to ssh in, of course there are no keys for ssh to use.

You can click the download icon next to the name of the keypair to download the keys or just click on the name and see the keys in the text fields.

I just looked and didn’t find the keys directly either. But I didn’t look too hard. You can get them as described above and then place them somewhere for your cronjob.

1 Like

Will the keys still be there after an update/upgrade if I do this?

If the location you store them survived an update depends on the location and whether you install an update / upgrade with a fresh install and wiped drive.
Just backup your folder where you store them and check after an update. It’s not like there are a daily updates/automatic updates.

Maybe someone can you point to the location where they are stored though. I’m pretty certain the key pair generated in the UI itself survives an update. Just remember that .ssh (where the public keys for your user are stored) needs a manual backup. That is not stored with the config.

1 Like

Thank you!

I have never had to renew any SSH keys built for ZFS send between machines. They just work - across multiple reboots, upgrades, whatever.

I only used the GUI to set up the connection between machines, i.e. followed a supported approach for getting the task done. The results may very well be different if attempted from the CLI, like most things TrueNAS.

Somehow, I think they’re store
In the config.