When you’re setting up SSH on a new Linux install you need to be aware of the right permissions for your files - especially if you’re manually importing files from another installation. Below you’ll find a list of what permissions are required for what files/directories.
To set these permissions, just run
chmod XXX FILENAME where you replace XXX with the permission number and FILENAME with the file/path.
.sshdirectory - 700 - this makes it not writeable by other users.
- Private key (such as id_rsa) - 600 - non-writeable by other users and not executable by anyone
- Public key (such as id_rsa.pub) - 644 - readable by other users (such as other services attempting to authenticate) and non-executable
authorized_keys- 644 - readable by other users, non executable