Linux ssh key authentication for Automatic Logon

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.