3

I have MASTER key under user alexus, yet whenever trying to ssh as root and/or other users on the box via sudo and getting error Bad owner or permissions on /root/.ssh/config

[root@wcmisdlin02 ~]# ls -ld .ssh
lrwxrwxrwx. 1 root root 17 May 14 13:00 .ssh -> /home/alexus/.ssh
[root@wcmisdlin02 ~]# ll .ssh/config 
-rw-------. 1 alexus alexus 215 Feb  4 12:47 .ssh/config
[root@wcmisdlin02 ~]# ssh XXXXX
Bad owner or permissions on /root/.ssh/config
[root@wcmisdlin02 ~]# 

This was working before, I recently rebuild my system and trying to get this to work and can't figure out what's missing(

[root@wcmisdlin02 ~]# getenforce 
Permissive
[root@wcmisdlin02 ~]# 

Please advise.

8

You have used symlinks so that /root/.ssh is a symlink to /home/alexus/.ssh. Ssh is not going to like that, because it gives alexus write access to .ssh/config and all the other .ssh/* files.

You need to remove the symlink, copy the files into root's directory, and change the ownership of all of it to root. If you're doing the symlink stuff so that root and alexus share a keypair, you may be able to symlink just the id_* files into /root/.ssh/.

Something like this:

rm /root/.ssh
mkdir /root/.ssh
cp /home/alexus/.ssh/* /root/.ssh/
chown -R root /root/.ssh
rm /root/.ssh/id_*
ln -s /home/alexus/.ssh/id_* /root/.ssh/
  • Note that this solution requires modifying the default permissions on the /root directory so that the user alexus can read those files. Not sure, but probably setting StricModes to no in /etc/ssh/sshd_config would be needed as well. – dawud May 14 '13 at 18:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.