Ssh password-free Login
Recently, I used rsync to process sync from the ssh channel. However, ssh requires a password pair to be used for rsync, and it is also placed into cron auto-dynamic lines, no one can find the password. It will cry ~
Secret generation using ssh-keygen id_rsa, id_rsa.pub
$ Ssh-keygen-t rsa or ssh-keygen-d (dsa)
Send the generated id_rsa.pub to the peer's host using scp. (Password authentication is still required in this process)
$ Scp id_rsa.pub server_hostname :~ /. Ssh/
Redirect to the opposite host
$ Ssh server_hostname
Combine the id_rsa.pub from the authorization with authorized_keys.
$ Cat. ssh/id_rsa.pub>. ssh/authorized_keys
In this way, the sub-account can log on through the key authentication without entering the password.
If there is no. ssh access on the host of the peer, you can create and use it on your own.
######################################## #########################
Three steps are required to configure SSH password-less Logon:
1. Generate public and private keys
2. Import the public key to the authentication file and change the permission.
3. Test
1. Generate public and private keys
Shell code
Ssh-keygen-t rsa
The default value is ~ /. Generate two files in the ssh directory:
Id_rsa: Private Key
Id_rsa.pub: Public Key
2. Import the public key to the authentication file and change the permission.
2.1 import Local Machine
Shell code cat ~ /. Ssh/id_rsa.pub> ~ /. Ssh/authorized_keys
2.2 import the server for password-free Login
First, copy the public key to the server.
Shell code scp ~ /. Ssh/id_rsa.pub xxx @ host:/home/xxx/id_rsa.pub
Then, import the public key to the authentication file. This step is performed on the server.
Shell code cat ~ /Id_rsa.pub> ~ /. Ssh/authorized_keys
2.3 Change permissions on the server
Shell code
Chmod 700 ~ /. Ssh
Chmod 600 ~ /. Ssh/authorized_keys
3. Test
Ssh host, the First Login may require yes confirmation, and then you can log on directly.
4. You can directly execute the command
Ssh 10.207.139.62 'hostname'