SSH does not have password logon to use the public key and private key. Linux can be used to generate a public/private key pair with Ssh-keygen.
There is a machine a,b (192.168.0.32). Now want a password to login to B via SSH.
1. Generate a public/private key pair under a machine.
➜~ ssh-keygen-t rsa-p '
-p means the password,-p ' means null password, also can not use the-p parameter, this will be three car return, with-P on a return.
The command will generate a pair of key id_rsa and id_rsa.pub under the/root/.ssh directory.
RSA key for SSH in common use:
Id_rsa private Key
Id_rsa.pub Public Key
The following command produces different types of keys
Ssh-keygen-t DSA
SSH-KEYGEN-T RSA
Ssh-keygen-t RSA1
2. Copy all the files under the A-machine directory ~/.ssh/to the B-machine ~/.ssh/directory, first to create ~/.ssh on the B-machine directory, with the SCP replication.
[xqzhang@pekdev032 ~]$ mkdir. SSH
➜~ SCP. ssh/* 192.168.0.32:/home/xqzhang/.ssh/copy id_rsa.pub to Authorized_keys file,
[xqzhang@pekdev032 ~]$ chmod-SSH
[xqzhang@pekdev032. ssh]$ chmod 600 *
Because there is no password-free login, so you want to enter a B-machine root password.
Authorized_keys's permission, if!!!
. SSH directory permissions if the!!!
3.A Machine login B machine. Ssh-l Xqzhang 192.168.0.32
The first time you log in is when you type Yes.
Now a machine can login without a password B machine.
Summary: Log on the machine can have a private key, the machine is logged in to have the public key of the machine. This public/private key pair is typically generated in the private key host host. The above is the RSA algorithm with the public/private key pair, of course, can also use DSA (corresponding file is id_dsa,id_dsa.pub)