HostA login via ssh needs to hostB, to achieve free secret landing, and SCP-free transmission of documents secret
Because hostA To log in to hostB
You first need to generate a key on hostA, use the following command
ssh-keygen -t rsa
Press 3 Enter
You can then use ls -atrl command to view the contents of files in the current directory under .ssh user directory
.ssh file generation directory
authorized_keys: storing a public key remote login-free dense , mainly through the public records file multiple machines
id_rsa: private key file generated
id_rsa.pub : generated public key file
know_hosts: known public key list host
If you want to ssh public key into force at least the following two conditions:
1) .ssh directory permissions must be 700
2) .ssh / authorized_keys file permissions must be 600
Set free secret landing, due to the need to avoid hostA is close to landing hostB, you need to transfer files to the public key hostA hostB to, the following two commands
ssh-copy-id -i ~/.ssh/id_rsa.pub 172.16.103.6
scp -p ~/.ssh/id_rsa.pub [email protected]:/root/.ssh/authorized_keys
Free secret landing can be realized directly using ssh ip ssh host name or address after the configuration is complete.