Environment:
SSH server:192.168.100.29 server.example.com
SSH client:192.168.100.30 client.example.com
Create secret key authentication through root user to implement Shell script management, distribution, deployment
First, the client side creates the secret key pair and distributes the public key to the SSH server that needs to be logged on
Note: The public key is equivalent to a lock, the private key is equivalent to a key, we here is equivalent to create a pair of keys and locks on the client, want to do ssh password-free login, the equivalent of our lock distribution to the server and lock, then the client can use the key to unlock.
I. Establishing secret key authentication
1. Create a secret key pair on the client: (SSH client)
# Su-root
# Ssh-keygen-t DSA
You can return all the way
----------------------
Generating Public/private DSA key pair.
Enter file in which to save the key (/ROOT/.SSH/ID_DSA):
Created directory '/root/.ssh '.
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:
e9:5e:4a:7f:79:64:c5:ae:f2:06:a7:26:e4:41:5c:0e root@zabbix.example.com
The key ' s Randomart image is:
+--[DSA 1024]----+
| |
| E. |
| . + . |
| . O. o|
| S. O |
| . O. + .|
| Oo.. B. |
| o +o * + |
| O. + =. |
+-----------------+
----------------------
2. View the generated secret key pair: (SSH client)
# Ls-lda. SSH
-----------------
DRWX------2 root 4096 June 6 23:03 SSH
-----------------
# CD. SSH
# Ls-la
------------------
Total dosage 16
DRWX------2 root 4096 June 6 23:03.
Dr-xr-x---. Root root 4096 June 6 23:03.
-RW-------1 root 668 June 6 23:03 ID_DSA
-rw-r--r--1 Root 613 June 6 23:03 id_dsa.pub
------------------
Secret key Generation Complete