Environment prepares two Linux servers:
Prepare an SSH server (System environment CENTOS6.5,IP address 192.168.100.100)
Prepare an SSH client (System environment CENTOS6.5,IP address 192.168.100.101)
1. Check if the SSH package is installed
[Email protected] ~]# Rpm-qa openssh-server OpenSSL
Openssh-server-5.3p1-94.el6.x86_64
Openssl-1.0.1e-15.el6.x86_64
2. Start the SSH service
[[email protected] ~]#/etc/init.d/sshd start
3. Create a key pair
[[email protected] ~]# Ssh-keygen all the way to return
Generating public/private RSA key pair.
Enter file in which to save the key (/ROOT/.SSH/ID_RSA):
Enter passphrase (empty for no passphrase):
Enter same Passphrase again:
Your identification has been saved In/root/.ssh/id_rsa.
Your public key has been saved in/root/.ssh/id_rsa.pub.
The key fingerprint is:
94:89:72:48:48:bb:89:cc:00:af:c0:69:e4:e8:13:5f [email protected]
The key ' s Randomart image is:
+--[RSA 2048]----+
|. O ... |
|*.oo. . o |
|+*o Oeo + |
| BOOO.O. |
|o=o. S |
| . |
| |
| |
| |
+-----------------+
4. Copy the public key to the client
[Email protected] ~]# ssh-copy-id-i ssh/id_dsa.pub [email protected]
The authenticity of host ' 192.168.100.101 (192.168.100.101) ' can ' t be established.
RSA key fingerprint is 5d:1b:b2:67:84:23:83:f9:59:3b:bd:91:b5:8f:c2:a9.
Is you sure want to continue connecting (yes/no)? Yes
warning:permanently added ' 192.168.100.101 ' (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.
5. Test login, no password to login directly to the client
[[email protected] ~]# ssh [email protected]
6.ssh-copy-id How to use non-22 ports
[Email protected] ~]# ssh-copy-id-i/root/.ssh/id_rsa.pub '-p port number [email protected] '
No interactive access configuration for Linux ssh