HOWTO : installing man ssh-keygen on 2 servers

pilpelet

Verified User
Joined
Oct 12, 2003
Messages
108
Hello ,

This howto is a step by step instructrion on how to install ssh keys on 2 computers or more . Usefull when there is a need to move files by crons or other programs beeten 2 servers without
needing to enter the remote host passpahres and password each time .

P-s needed for sysbk script and others for full backup to other server for e.g .


local host :

cd /root/.ssh
If the folder is not there its possible to just create it .

creating the ssh key on server A (local)
ssh-keygen -t dsa -f /root/.ssh/id_dsa
Notice that after this command it created few keys

run

cat id_dsa.pub >> authorized_keys

dont worry it will create authorized_keys automaticly


Now open connection to server B (remote)
and basicly do the same

ssh-keygen -t dsa -f /root/.ssh/id_dsa
cat id_dsa.pub >> authorized_keys

go back to server A and run

scp id_dsa.pub remote_ip:/root/.ssh/host1.key.pub
scp remote_ip:/root/.ssh/id_dsa.pub ./host2.key.pub

Enter password of server B if asked .

it basicly moves the keys from server A to B and vise versa
[ remote_ip in the command is the IP of serve B ]

run
cat host2.key.pub >> authorized_keys

backe to server B
run
cat host1.key.pub >> authorized_keys

That it , the keys are in place .

Notice that if you try to ssh to server B from A it wont ask for password or other things and will just log you in as if it the same machine . :)
 
Last edited:
Back
Top