Linux ssh password-free login, linuxssh password-free Login
Target: Local Machine ssh Login remote target machine without entering a password (by default, ssh user@192.xxx.x.xxx requires a password)
Principle: PassPublic Key and Private KeyImplement system authentication
Implementation:Public KeyCopy to target machine
Details:
1. Generate a public key/private key pair on the local machine (skip this step if it has already been executed)
Ssh-keygen-t rsa
Or ssh-keygen-t rsa-p''
-P indicates the password.-P ''indicates that the password is empty, or you do not need the-P parameter. In this case, you have to press enter three times and press enter once with-P.
The command is in ~ The/. ssh/directory generates two files: id_rsa (Private Key) and id_rsa.pub (Public Key)
2. Copy the public key of the local machine to the target machine.
Method 1:
Ssh-copy-id user@192.xxx.x.xxx
This command will copy the public key of the local machine to ~ /. Ssh/authorized_keys File
Method 2:
Scp ~ /. Ssh/id_rsa.pub user@192.xxx.x.xxx :~ /. Ssh/
Cat id_dsa.pub >> ~ /. Ssh/authorized_keys
(Or directly scp ~ /. Ssh/id_rsa.pub user@192.xxx.x.xxx :~ /. Ssh/authorized_keys)
3. Then, log on to the remote machine using ssh remote_host without the password.
Refer:
Use ssh-keygen and ssh-copy-id to achieve SSH password-less Login
Ssh-keygen to generate key settings, so that ubuntu can log on to linux without a password
How to use ssh-keygen