Wednesday, November 7, 2012

Setup Passwordless login through SSH




Server 1 == IP 192.16.0.1    Application
Server 2 == IP 192.16.0.2    Backup

Step 1: Create SSH keys in both servers
Server1: 192.16.0.1:
# cd /root/.ssh
# rm -rf /root/.ssh/*
# ssh-keygen

Server 2: 192.16.0.2:
# cd /root/.ssh
# rm -rf /root/.ssh/*
# ssh-keygen

Step 2: Copy the public keys to other server
Server 1: 192.16.0.1:
# scp /root/.ssh/id_rsa.pub root@192.16.0.2:/root/.ssh/authorized_keys

Server 2: 192.16.0.2: 
# scp /root/.ssh/id_rsa.pub root@192.16.0.1:/root/.ssh/authorized_keys

Step 3: Restart SSH service in both servers
Server 1: 192.16.0.1
# service sshd restart

Server 2: 192.16.0.2
# service sshd restart

Step 4: Now check login without password
Server 1: 192.16.0.1
# ssh 192.16.0.2      => check whether logging in without password

Server 2: 192.16.0.2
# ssh 192.16.0.1      => check whether logging in without password

No comments:

Ansible Playbook to collect uptime of servers

Hi,  This is to explain how we can write a small playbook to collect uptime of all servers in our environment. We can use our own server l...