Talk:SSH public key authentication

Include information on where the authorized keys end up

After adding `openssh.authorizedKeys.keys` and doing a `nixos-install`, I checked if the keys I provided where indeed installed. Since I did not find them in `~/.ssh/authorized_keys` I thought I had done something wrong, although it didn't generate an error.

I looked in that location, because as a long time ssh user (1996, although I retired the RSA-1024 key I started with), that is where I expected the keys to be stored. So I added the file by hand after installation, before rebooting, and remote login worked as expected.

I never realised these keys are stored in `/etc/ssh/authorized_keys.d/<user>`, and that trying to login after rebooting without the manual additon to `~/.ssh/authorized_keys` would have worked as well. That realisation only came much later by analysing the `/etc/ssh/sshd_config` that NixOS generated.

My suggestion is to add one line of information on this page, to indicate where the keys might be found. I can make that edit, but I would first like to ask if that is a good idea. Anthon (talk) 06:55, 18 August 2026 (UTC)Reply

Hey anthon, it seems fine to me. Hans4687 (talk) 08:27, 18 August 2026 (UTC)Reply
Return to "SSH public key authentication" page.