Chủ Nhật, 24 tháng 2, 2013

SSH không cần Password

1./  Create a pair of Private Key and Public key on SSH Client(Putty, Xshell, or ssh Linux client).
2./ On target linux machine:
2.1/ edit /etc/ssh/sshd_config, it has these values:


     RSAAuthentication yes
     PubkeyAuthentication yes
     AuthorizedKeysFile      .ssh/authorized_keys


2.2/ Create file ~/.ssh/authorized_keys


[root@centos01 ~]# ll .ssh/
total 12
-rw-------. 1 root root 588 Feb 21 06:37 authorized_keys
-rw-------. 1 root root 668 Feb 21 06:35 id_dsa
-rw-r--r--. 1 root root 613 Feb 21 06:35 id_dsa.pub


2.3/ Add public key of SSH Client to  "~/.ssh/authorized_keys" on Target Linux. reminding permission on "~/.ssh/authorized_keys" on target linux is 600.
3./Done.

When ssh client connect to linux target, the client will use private key to authentication, encryption data before transmit to linux target. Linux target will use public of the client to authentication to identify the client.

Không có nhận xét nào: