I just spent the better part of the last 2 days working on setting up SSH with private/public shared keys. I've done this many a times so I launched my nifty file containing the documentation I've used in the past and went to work. I first made my key pairs on both machines, and then I transfered the file to there respective sides. The connection for hostA to hostB worked flawlessly from the first instance, now hostB to hostA was another story. Of course the first thing I did was check the permissions:
hostA:> chmod 700 ~user1/.ssh
hostA:> chmod 600 ~user1/.ssh/*
and tried again... still did not work. Next I checked the /etc/ssh/sshd_config , everything looked fine and actually when diff'd with the one on the other server, they were identical. I should mention that hostB is a Redhat ES 4.4 server and hostA is Centos 4.4 server (basically identical). Well I scratched my head and went to google. Of course every forum and mailing list result I found said: "check the permissions". Well I did it again..... and again... and again.... still no luck. This is when I decided to try a different user.
hostA:> chmod 700 ~user2/.ssh
hostA:> chmod 600 ~user2/.ssh/*
And guess what.... it worked. this is when it hit me. the actuall directory structure. The typical hierarchy looks like this:
owner path
root /home
user1 /home/user1
user2 /home/user2
but this was my hierarchy:
owner path
root /home
user2 /home/user2
user1 /home/user2/user1
All I can figure is that since the parent to the users home was not owned by root, SSH didn't work. Solution:
owner path
root /home
user2 /home/user2
user1 /home/user1
ln -s /home/user1 home/user2/user1
Argh.... 2 days wasted and while I swore it was not permissions, it was just under the name "ownership". All because for layout reasons I want the home directory of one user with in the other.
No comments:
Post a Comment