CentOS 6.6 SSH key from password


Generate a public key and a private key file–> to import the public key file contents into native authentication documents, and change the permissions–> take out the private key file login test
1, generate a public key and a private key file
[root@kvm ~]# ssh-keygen -t rsa
Here along the carriage returns as well, you can also enter a password (this password is used for SSH key is not the password)
See/root directory automatically creates a. ssh directory/root/.ssh directory generated the key pair file
Id_rsa private key
Public key id_rsa.pub
2, import the public key file contents into native authentication files and change permissions
[Root@KVM. ssh]#/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys # will be added to the certification public key file contents in the file authorized_keys
[Root@KVM. ssh]# permissions to chmod/.ssh/authorized_keys # change the authentication file to 600, this step is very important
[Root@KVM. ssh]# chmod/.ssh//root/.ssh # change directory into 700
3, copy a file to another machine to verify private key
3.1 under Windows using xshell to test
3.2, with a Linux host to test