This hopes to explain in simple steps setting up a pair (or more) servers as a trusted group.
So what do we want to achieve ? Well we wnat to be able to ssh, sftp, rsync etc between servers and not need to enter passwords
Steps required
1 Hosts File
2 Editing sshd_config
3 Create the ssh keys
4 Setting up the Auth. users file
Hosts File
Firstly we need to make sure all servers are in the hosts file
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
127.0.0.1 asterisk2.local
# We point to eth0 on our own box
192.168.10.100 asterisk2.local
192.168.10.100 asterisk2
# We point to eth1 on the other box
192.168.10.108 asterisk1
Editing sshd_config
Now we need to edit the /etc/ssh/sshd_config file
so that the following
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /root/.ssh/authorized_keys
replaces
#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys
Now restart the sshd
/etc/init.d/sshd restart
Create the ssh keys
We now need to create the keys on each server
ssh-keygen -t rsa
and hit return for all the questions.
this will create 2 files in /root/.ssh
go the /root/.ssh directory and copy the id_rsa.pub to the other server and get its id_rsa.pub
sftp asterisk1
put id_rsa.pub asterisk2.pub
get id_rsa.pub asterisk1.pub
bye
Setting up the Auth. users file
In the /root/.ssh directory you will now have for example :-
asterisk1.pub id_rsa id_rsa.pub known_hosts
We now need to copy the asterisk1.pub to the authorized_keys file
cat asterisk1.pub >> authorized_keys
Do the same on the other server.
You should now be able to ssh and rsync between servers.