12 August 2017 | 1 min read

How to sync *.ssh keys and set permissions

Assalamualaikum wbt and greeting everyone! I’ve had the same ssh keys for years. I just rsync them to a new system when I get one. The problem is I always seem to end up with mucked up permissions moving them around and never seem to remember how the permissions were set. Now let put some note as my future reference here.

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys
$ chmod 644 ~/.ssh/config
$ chmod 600 ~/.ssh/id_rsa
$ chmod 644 ~/.ssh/id_rsa.pub
$ chmod 644 ~/.ssh/known_hosts
$ ssh-add

It should be okey and worked!

Update : Another great tips from mcepl is to use chmod 600 on ~/.ssh/config and ~/.ssh/known_hosts file plus more athmane said if you selinux is enforcing mode, just execute restorecon -Rv ~/.ssh from terminal.

Robbi Nespu | Fedora, Linux


Discussion and feedback