For linux ssh key authentication, log on to [Server configuration] and configure Server first to enable public key authentication. Run vim/etc/ssh/ssh_config www.2cto.com as the root user to open the following two lines of configuration: RSAAuthentication yesIdentityFile ~ /. Ssh/id_rsa and then restart the ssh service:/etc/init. d/sshd restart [client generation key] assume that user0 has no password to log on to remotehost, log on to the client with user0, and then execute ssh-keygen-t rsaGenerating public/private rsa key pair. enter file in which to save the key (/home/user0 /. ssh/id_rsa): Created directory '/home/user0 /. ssh '. enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in/home/user0 /. ssh/id_rsa.Your public k Ey has been saved in/home/user0 /. ssh/id_rsa.pub.The key fingerprint is: f1: e8: AE: a7: b3: f6: 64: 3f: 30: 34: 1f: c5: 07: ce: 0f: bc myid @ localhost: Press enter three times in a row. Generally, the default output path is correct. passphrase is empty for automatic logon. Note: Because passphrase is empty, the generated private key must be absolutely forbidden from unauthorized access! Copy the generated id_rsa.pub file to/home/user0/of remotehost /. in the ssh/directory, [upload the public key to the server /. copy ssh/id_rsa.pub to/home/user0/on the server /. ssh directory, and rename it as the authorized_keys file. Note that setting it to another user cannot be read or written. Chmod 400/home/user0/. ssh/id_rsa.pubscp/home/user0/. ssh/id_rsa.pub user0 @ remotehost:/home/user0/. ssh/authorized_keys