To establish a security trust relationship between the root of the Client and the root of the Server, follow these steps:
1. Run the ssh-keygen command on the Client to generate a certificate that establishes a security trust relationship.
[Root @ Clientroot] # ssh-keygen-B 1024-t rsa
Generatingpublic/private rsa key pair.
Enter file inwhich to save the key (/root/. ssh/id_rsa ):
Enter passphrase (empty for no passphrase): <-- press Enter
Enter samepassphrase again: <-- press Enter.
Youridentification has been saved in/root/. ssh/id_rsa.
Your public keyhas been saved in/root/. ssh/id_rsa.pub.
The key fingerprintis:
49: 9c: 8a: 8f: bc: 19: 5e: 8c: c0: 10: d3: 15: 60: a3: 32: 1croot @ Client
[Root @ Clientroot] #
Note: When the program prompts you to enter passphrase, enter the carriage return, indicating no certificate password.
The above command generates the Private Key Certificate id_rsa and Public Key Certificate id_rsa.pub, which are stored in the. ssh subdirectory of the user's home directory.
2. Copy the Public Key Certificate id_rsa.pub to the. ssh subdirectory of the root directory of the Server, and change the file name to authorized_keys.
[Root @ Client root] # scp-p. ssh/id_rsa.pub root@192.168.3.206:/root /. ssh/authorized_keysroot@192.168.3.206's password: <-- enter the root user password of the Server id_rsa.pub 100% | **************************** | 218 00:00 [root @ Client root] #
When executing the preceding command, the root user of the two machines has not yet established a security trust relationship, so you also need to enter the root user password of the machine Server.
After the above two steps, the security trust relationship is established between the root of the Client and the root of the Server. Let's take a look at the effect:
[Root @ Clientroot] # scp-p text root@192.168.3.206:/root
Text 100% | ************************** | 19
[Root @ Clientroot] #
Successful! You do not need to enter the password any more.