For Mac OS install Ssh-copy-id:
Brew Install Ssh-copy-id
For Linux Install Ssh-copy-id
Yum Install openssh*
STEP:
1: Generate SSH Public key
[Email protected] ~]# ssh-keygen-t DSA
Generating Public/private DSA key pair.
Enter file in which to save the key (/ROOT/.SSH/ID_DSA):
Enter passphrase (empty for no passphrase):
Enter same Passphrase again:
Your identification has been saved IN/ROOT/.SSH/ID_DSA.
Your public key has been saved in/root/.ssh/id_dsa.pub.
The key fingerprint is:
6e:20:94:d5:e1:cc:42:9f:37:de:ce:bb:d9:e4:f6:6d [email protected]
A hidden directory is generated in the current home directory. SSH and DSA files
[email protected]. ssh]# Ls-la
Total 24
drwx------2 root root 4096 Jul 8 06:17.
Drwxr-x---4 root root 4096 Jul 8 06:10.
-RW-------1 root root 622 Jul 8 06:10 Authorized_keys
-RW-------1 root root 668 Jul 8 06:17 ID_DSA
-rw-r--r--1 root root 605 Jul 8 06:17 id_dsa.pub
2:copy public key to a server that requires password-free login
[email protected]. ssh]# ssh-copy-id-i id_dsa.pub [email protected]
10
The authenticity of host ' 172.16.1.11 (172.16.1.11) ' can ' t be established.
RSA key fingerprint is 31:e6:9a:7a:02:a4:60:eb:b8:44:d0:30:80:1c:76:7d.
Is you sure want to continue connecting (yes/no)? Yes
warning:permanently added ' 172.16.1.11 ' (RSA) to the list of known hosts.
[email protected] ' s password:
Now try logging to the machine, with "ssh" [email protected] ' ", and check in:
. Ssh/authorized_keys
To make sure we haven ' t added extra keys so you weren ' t expecting.
3: Implement password-free login
[email protected]. ssh]# ssh [email protected]
Last Login:fri Jul 8 02:00:40 from 172.16.1.1
[Email protected] ~]#
SSH Key Password-free authentication