How can I share the SSH keyes between two users on a CentOs 7 machine?
First and foremost: use ls -lhAZ
(-Z
on a SELinux enabled System), it shows Linux file ownership, permissions and SELinux label.
Reset permissions on the directory and file:
# DAC - Restore permissions
chmod 0700 ~anobili/.ssh
chmod 0600 ~anobili/.ssh/authorized_keys
# Restore ownership
chown -R anobili ~anobili/.ssh
# MAC - Restore SELinux
restorecon -R ~anobili/.ssh
This is what it's supposed to look like:
$ ls -lhaZ | grep .ssh
drwx------. 2 user group unconfined_u:object_r:ssh_home_t:s0 4.0K Feb 21 18:52 .ssh
$ ls -lhaZ .ssh
-rw-------. 1 user group unconfined_u:object_r:ssh_home_t:s0 0 Feb 21 18:53 authorized_keys