Ubuntu – What does %h mean in SSHD configuration

configurationsshd

I'm setting up OpenSSH on a server and I've created my keys on my client, but I don't know where I'm supposed to put the public key on the host. I understand it needs to be added to the authorized_keys file, but where is the authorized keys file? In sshd_config it has it at

%h/.ssh/authorized-keys

I look around a bit and I've seen people refer to %h as being a shortcut for the home directory, but is it home directory as in /home/.ssh or is it /home/user/.ssh?

Forgive my ignorance and thank you in advance!

The .ssh directory is at neither locations, I already looked.

Best Answer

According to man 5 sshd_config:

%h is replaced by the home directory of the user being authenticated

This means the file will be /home/user/.ssh/authorized_keys. If the .ssh directory is missing (which seems normal if not previously configured) you can create it and also the authorized_keys file within and then populate the file's contents with your public key.

Related Question