Environment description
[Email protected] ~]# cat/etc/redhat-release CentOS release 6.5 (Final) [[email protected] ~]# Uname-alinux localhost1 2 .6.32-431.el6.x86_64 #1 SMP Fri Nov 03:15:09 UTC x86_64 x86_64 x86_64 gnu/linux
Generate secret Key
[Email protected] ~]# ssh-keygen-t rsagenerating public/private RSA key pair. Enter file in which to save the key (/ROOT/.SSH/ID_RSA): Created directory '/root/.ssh '. Enter passphrase (empty for no passphrase): Enter same passphrase Again:your identification have been saved in/root/.ssh/ Id_rsa. Your public key have been saved in/root/.ssh/id_rsa.pub.the key fingerprint is:5e:5a:d4:7f:97:29:39:54:b9:1b:eb:13:12:4c : bc:2b [email protected]the key ' s randomart image is:+--[RSA 2048]----+|. ..|| . O.. | | . +.. .|| . . =.oo| | S o ++o*| | . + E oo=.| | O. O. | | O | | .| +-----------------+
Configuring the Secret key Connection
[Email protected] ~]# cat/root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys[[email protected] ~]# chmod 700/roo t/.ssh/*
Copy the local host's public key to the remote host's Authorized_keys file
[Email protected] ~]# ssh-copy-id-i/root/.ssh/id_rsa.pub [email protected]the authenticity of host ' 192.168.8.20 (192.1 68.8.20) ' can ' t be established. RSA Key fingerprint is 63:fe:c9:db:12:66:13:d0:23:e1:33:19:3d:cb:10:72.are your sure you want to continue connecting (yes/n o)? yeswarning:permanently added ' 192.168.8.20 ' (RSA) to the list of known hosts. [email protected] ' s password:
Edit an SSH configuration file
[Email protected] ~]# vim/etc/ssh/sshd_config Rsaauthentication yes48 pubkeyauthentication Yes
Another machine can do it in reverse to achieve a secret-free access between two
Configure secret-free access between Linux