Configure SSH connection between servers

From Kolmisoft Wiki
Revision as of 09:40, 6 June 2014 by Mindaugas (talk | contribs)
Jump to navigationJump to search

Manual configuration:

On GUI server:

ifconfig <and mark IP of GUI server>
rm /var/www/.ssh/id_rsa
rm /var/www/.ssh/id_rsa.pub
su apache
ssh-keygen -t rsa
<Press ENTER 3 times>
exit

chmod 700 /var/www/.ssh
cp /var/www/.ssh/id_rsa.pub /var/www/html


On APP (Remote) server:

# move old pub file (backup)
cd /root
mv id_rsa.pub id_rsa.pb.old

#  download pub key from GUI server
wget http://<GUI_SERVER_IP>/id_rsa.pub
 
mkdir /root/.ssh
touch /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
chmod 700 /root/.ssh

# include pub key into authorize_keys file
cat /root/id_rsa.pub >> /root/.ssh/authorized_keys
rm -rf /root/id_rsa.pub

ifconfig <and mark IP of APP server>


On GUI server:

su apache
ssh -o StrictHostKeyChecking=no root@<IP of APP server> -f "exit"
# should see: Warning: Permanently added '<IP of APP server>' (RSA) to the list of known hosts.

#test
ssh root@<IP of APP server>
ifconfig

#should see that you are on APP server
# log out
exit

rm -fr /var/www/html/id_rsa.pub