I seem to never be able to remember the proper permissions for the .ssh-folder, so here's a note about it.
May it be forever remembered!
File/folder | Numeric notation (octal) | Symbolic notation |
.ssh | 700 | drwx------ |
public key, id_rsa.pub | 644 | -rw-r--r-- |
private key, id_rsa | 600 | -rw------- |
authorized_keys | 644 | rw-r--r-- |
config | 600 | rw------- |
Example
$ chmod 600 .ssh/id_rsa
$ ll id_rsa
-rw------- 1 sorin sorin 2602 Oct 15 2021 id_rsa
Gotchas'
Make sure the user owns the .ssh-folder and files and not root!
$ chown -Rv sorin.sorin /home/sorin/.ssh
Misc
Also see Ssh to remote computer asks for password despite certificates in place and Passwordless ssh.
Sources
https://superuser.com/questions/215504/permissions-on-private-key-in-ssh-folder
https://www.tecmint.com/set-ssh-directory-permissions-in-linux/
https://help.ubuntu.com/community/SSH/OpenSSH/Keys
https://wintelguy.com/permissions-calc.pl