mkdir ~/.ssh
chmod ~/.ssh
SSH-KEYGEN-T RSA
Ssh-keygen-t DSA
Then, execute the following command on the node Dbtest1
Cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
SSH dbtest2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
SSH dbtest2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
SCP ~/.ssh/authorized_keys Dbtest2:~/.ssh/authorized_keys
Node 1:
node1:~ #cd/root
node1:~ # mkdir. SSH
node1:~ # chmod. SSH
node1:~ # ssh-keygen-t RSA
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:
b0:1d:73:0a:99:2a:ee:ce:cd:5f:de:e5:db:c9:ab:6e [MD5] [email protected]
The key ' s Randomart image is:
+--[RSA 2048]----+
| |
| o |
| = O. |
| . = = |
| . . . S |
| . . |
| . . . |
| o O. Oeo. |
|. + O ..... o=o=. |
+--[MD5]----------+
node1:~ # 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:
9c:93:19:6b:df:bd:f3:01:b6:82:be:32:0c:ee:b0:68 [MD5] [email protected]
The key ' s Randomart image is:
+--[DSA 1024x768]----+
| |
| |
| . |
| . * |
| S O |
| . . O....O |
| .. o ..... |
| E.. O. +. . ...|
|.. ... oo. . o.|
+--[MD5]----------+
node1:~ #
Node 2
node2:~ # Cd/root
node2:~ # mkdir. SSH
node2:~ # chmod ssh/
node2:~ # ssh-keygen-t RSA
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:
f2:ca:0c:73:98:04:55:69:48:1a:9a:a8:8e:0c:96:0c [MD5] [email protected]
The key ' s Randomart image is:
+--[RSA 2048]----+
| .. Oo.. |
|. O +. o |
| E O. |
|+ .. |
|o+. . S |
|* . o O |
|. o =. . |
| * . |
| + |
+--[MD5]----------+
node2:~ # 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:
6a:c4:e1:cc:bb:c7:32:51:5c:96:49:46:24:df:86:ad [MD5] [email protected]
The key ' s Randomart image is:
+--[DSA 1024x768]----+
| . +=o |
| +=+ |
| .. OO + |
| =. o O |
| *. S E |
| .. o |
| +o |
| . o.o |
| .+ |
+--[MD5]----------+
node2:~ #
Sync Authorized_key
NODE1:~/.SSH # cat Id_rsa.pub >>authorized_keys
NODE1:~/.SSH # cat Id_dsa.pub >>authorized_keys
NODE1:~/.SSH # ssh Node2 cat/root/.ssh/id_rsa.pub >> Authorized_keys
The authenticity of host ' Node2 (10.0.0.31) ' can ' t be established.
ECDSA key fingerprint is b4:30:1b:97:e9:75:1e:e2:2c:85:91:2a:76:85:77:ce [MD5].
Is you sure want to continue connecting (yes/no)? Yes
warning:permanently added ' node2,10.0.0.31 ' (ECDSA) to the list of known hosts.
Password:
NODE1:~/.SSH # ssh Node2 cat/root/.ssh/id_dsa.pub >> Authorized_keys
Password:
NODE1:~/.SSH # SCP Authorized_keys node2:/root/.ssh/
Password:
Authorized_keys 100% 1984 1.9KB/S 00:00
NODE1:~/.SSH #
Test
NODE1:~/.SSH # SSH Node2 date
Sat May 9 05:40:58 CST 2015
NODE1:~/.SSH #
node2:~ # SSH Node1 Date
Sat May 9 05:41:03 CST 2015
node2:~ #
This article is from "Technical achievement dream!" "Blog, be sure to keep this provenance http://dreamsanqin.blog.51cto.com/845412/1659584
Configure SSH without password login under Linux