Login to server say A with a certain ip address.
Steps to execute
1.ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/a/.ssh/id_rsa): Created directory '/home/a/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/a/.ssh/id_rsa. Your public key has been saved in /home/a/.ssh/id_rsa.pub. The key fingerprint is: 3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
in the .ssh directory u would find three files:-
-rw-r--r-- 1 carisman asg 229 Nov 27 17:21 id_rsa.pub -rw------- 1 carisman asg 883 Nov 27 17:21 id_rsa -rw-r--r-- 1 carisman asg 2406 Dec 2 06:06 known_hosts -rw-r--r-- 1 carisman asg 1914 Dec 10 15:00 authorized_keys
where id_rsa.pub contains the public key of the server
id_rsa contains the private key.
Now say you wanna log into server b from server a via (ssh username@ip)
go to server b.find the .ssh directory which is actually a hidden dir.
now copy the public key of server a into the auihorized_keys file of server b.
then try again logging via ssh.
Next time it shouldn't prompt for password.
dys301a001: more authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA5/AGIVIbEpYMWnn1O8IOnVeG3k76bI9cYg+8Rqn/GjHzs5iownSQ0SOCRJmaXfdY4XLW/IhUNh0bLIN/hyHZXKzB1 KGH8dWT69fWaHdfUzCMI0coTqZp0S8CcblM6R8lZ5j7pLTmNyqS8zeDha6MPf+3IlfdsI0lhbOh4fM1un0= dial@hwsnet01 1024 35 110606535021230677166642170605791804032587756457705016112225220058665302167946280750828811369230048501248010930732174 09750990674780468447807993612977975979054372083446310435517956860073945567084113240701328264607148843115383124630161854727920 8805722148623831645095170046145961368543171199904180920721600578077 gipp@dyslby01 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAsUrfr0OqdoCx/4+R7pNj0aEoy/Ic6t+LQNZRbAQ67vipzej+Pt5ij5B5UTuUc3gSX0ABPJIv9oOsdxy8pvY07XYCB OXhgwuAxKLqCNROIRZvhLiaJNAqsCDwfYtG46rp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cHo+VRZL0qzEA3jwjy60DNLvohHWLm5s2xrQ50FUkpmIp4t5K4GjeaDcnM/eQ9wpuLLM= voip@dys118d001
If you look at the file you can see that the public keys have been generated at the respective servers and have been added to the authorized_key file of this server.
