Everything is Linux

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

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



Links to this post:

Create a Link

<< Home