Free Linux system ssh remote login close

  In the process of running Linux in some special circumstances make between different Linux hosts free SSH login dense, dense login is free Intuitively, precisely, is by secret key authentication login.

 

First, implement the principle of

  The A host needs to log in to a remote host B Free-tight, the tools need to generate the secret key for the host A above, i.e., public and private keys. To decrypt the private key, the local host is placed in A, the public key for encryption, host B is placed at the distal end.

 

Second, the example

1, for generating a secret key

  • A host executes the command in ssh-keygen -b 1024 -t rsa, without changing the parameters, you can press Enter a few times.
[root@server ~]# ssh-keygen -b 1024 -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:
b3:9d:90:f8:60:66:45:72:c1:2f:8f:ea:32:80:b6:4c root@server
The key's randomart image is:
+--[ RSA 1024]----+
|      ..+.       |
|       +.        |
|        ..       |
| the ... |
| .    * S+       |
| .E. + O = ... |
| + .. .oo |
| oo. |
|     +.          |
+-----------------+
  • Parameter Description:

-t [rsa | dsa] Specifies the type of key to create. You can use: "rsa1" (SSH-1) "rsa" (SSH-2) "dsa" (SSH-2), we have chosen rsa

-b 1024 specify the key length. For RSA keys, the minimum requirement 768, the default is 2048. DSA keys must be exactly 1024 (requires FIPS 186-2 standard).

  • This directory is generated at one pair of keys /root/.ssh/, id_rsa the private key, public key id_rsa.pub file, additional address record is known_hosts A host has logged distal ssh host, some case, we solve the problem by clearing this failed login files.

2, copy the public key file 

Copy the contents of the file id_rsa.pub out, pasted to the remote host B /root/.ssh/authorized_keys file, the default file authorized_keys does not exist, you can create manually.

3, the test

Without having to enter a password to login

 4, description

This test limits exist, the login host configuration requires open ssh remote access.

Guess you like

Origin www.cnblogs.com/itbox/p/12154472.html