Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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/
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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