A: Experimental environment:
1. Four SLES one -SP2 x86_64 minimized installation
2. where the host name and IP correspondence are as follows
Manager 192.168.78.11
Node1 192.168.78.12
Node2 192.168.78.13
Node3 192.168.78.14
Two: The configuration process is as follows:
1. Add The following to the manager 's /etc/hosts
192.168.78.11 Manager
192.168.78.12 Node1
192.168.78.13 Node2
192.168.78.14 Node3
2. generate a key pair without a private key password
manager:~ # Ssh-keygen
Generating public/private RSA key pair.
Enter file in which to save the key (/ROOT/.SSH/ID_RSA):// Direct Enter key
Created directory '/root/.ssh '.
Enter passphrase (empty for no passphrase):// Direct Enter key
Enter same passphrase again:// Direct Enter key
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:
C2:e9:a3:48:a5:57:3c:64:a8:b6:17:71:ff:93:4d:[email protected]
The key ' s Randomart image is:
+--[RSA 2048]----+
| |
| . |
| O + |
| . B O |
| Oo B S. |
| . + + O. + . |
| +o O + E. |
| . + . . . . |
| .. |
+-----------------+
manager:~ #
3. generate the Authentication file Authorized_keys and set the appropriate permissions
manager:~ # CD. ssh/
MANAGER:~/.SSH # ls
Id_rsa id_rsa.pub
MANAGER:~/.SSH # CP Id_rsa.pub Authorized_keys
MANAGER:~/.SSH # chmod Authorized_keys
MANAGER:~/.SSH # Ls-l
Total 12
-RW-------1 root root 394 Dec 05:13 Authorized_keys
-RW-------1 root root 1675 Dec 05:12id_rsa
-rw-r--r--1 root root 394 Dec 05:12 id_rsa.pub
MANAGER:~/.SSH #
4. copy the/root/.ssh directory to the root directory of Node1,node2,node3
manager:~ # for I in ' SEQ 1 3 '; Do scp-r/root/.ssh/node$i:/root/; Done
The authenticity of host ' Node1 (192.168.78.12) ' can ' t be established.
RSA key fingerprint is9d:f6:00:b6:96:ba:e3:0c:91:47:8d:36:a6:68:6a:cf.
Is you sure want to continueconnecting (yes/no)? Yes
warning:permanently added ' node1,192.168.78.12 ' (RSA) to the list of known hosts.
Password:
Authorized_keys 100% 394 0.4kb/s 00:00
Id_rsa 100%1675 1.6kb/s 00:00
Known_hosts 100% 229 0.2kb/s 00:00
Id_rsa.pub 100% 394 0.4kb/s 00:00
The authenticity of host ' Node2 (192.168.78.13) ' can ' t be established.
RSA key fingerprint is45:d1:31:ed:05:54:ec:a4:61:f2:a8:70:8f:97:8c:41.
Is you sure want to continueconnecting (yes/no)? Yes
warning:permanently added ' node2,192.168.78.13 ' (RSA) to the list of known hosts.
Password:
Authorized_keys 100% 394 0.4kb/s 00:00
Id_rsa 100%1675 1.6kb/s 00:00
Known_hosts 100% 458 0.5kb/s 00:00
Id_rsa.pub 100% 394 0.4kb/s 00:00
The authenticity of host ' node3 (192.168.78.14) ' can ' t be established.
RSA key fingerprint is45:d1:31:ed:05:54:ec:a4:61:f2:a8:70:8f:97:8c:41.
Is you sure want to continueconnecting (yes/no)? Yes
warning:permanently added ' node3,192.168.78.14 ' (RSA) to the list of known hosts.
Password:
Authorized_keys 100% 394 0.4kb/s 00:00
Id_rsa 100%1675 1.6kb/s 00:00
Known_hosts 100% 687 0.7kb/s 00:00
Id_rsa.pub 100% 394 0.4kb/s 00:00
manager:~ #
Note: The first time is based on the user name password authentication, so to enter the password
5. copy The/etc/hosts file to the/etc Directory of Node1,node2,node3
manager:~ # for I in ' SEQ 1 3 '; Do scp/etc/hosts node$i:/etc/; Done
6.SSH Accessing the machine (to add the manager to the. ssh/known_hosts file)
manager:~ # SSH Manager
The authenticity of host ' manager (192.168.78.11) ' can ' t be established.
RSA key fingerprint ise6:74:87:2c:5e:71:30:c8:ae:9d:87:d4:54:05:d0:22.
Is you sure want to continueconnecting (yes/no)? Yes
warning:permanently added ' manager,192.168.78.11 ' (RSA) to the list of known hosts.
Last Login:thu Dec 05:06:27 from192.168.78.1
manager:~ #
7. copy the. ssh/known_hosts file to the/root/.ssh/ directory in node1,node2,node3
manager:~ # for I in ' SEQ 1 3 '; Do scp/root/.ssh/known_hosts node$i:/root/.ssh/; Done
Configuration complete at this point
Three: Verify the configuration is successful
1. Choose a machine, such as Node3, to visit Manager,node1,node2 separately .
node3:~ # SSH Manager
Last Login:thu Dec 05:20:52 frommanager// No password login manager Success
manager:~ # Exit// exit to manager connection
Logout
Connection to manager closed.
node3:~ # SSH Node1
Last Login:mon Sep 29 23:24:13 2014
linux-x4xj:~ # Exit
Logout
Connection to Node1 closed.
node3:~ # SSH Node2
Last Login:mon Sep 29 23:24:28 2014
linux-hmae:~ # Exit
Logout
Connection to Node2 closed.
node3:~ #
the above-mentioned configuration is successful, thenode1,node2 node test ibid .
#############################################################################
Precautions:
1. If you want to reload a node such as reload Node2, perform the following 4 steps sequentially
◆ You need to back up the ssh directory under /etc/before reloading the Node2
◆ After the reload is complete, replace the SSH directory in the /etc directory with the backup SSH directory and restart the SSH service .
◆ then copy the. SSH directory from Manager,node1 or node3 to the /root directory in Node2
finally copy The hosts file to the/etc directory in node2
2. Normal user operation is the same as root user, and each ordinary user should do the above operation
#############################################################################
This article from "Never Stop" blog, declined reprint!
More than one Linux password-free access