SSH configuration Automatic Login

Source: Internet
Author: User

Assume that machine A is connected to machine B.

1. On Machine A, generate an RSA key pair

ssh-keygen -t rsa

Passphrase does not enter the password during this period. By default, files are generated ~ /. Ssh/

-RW ------- 1 WebAdmin 1675 October 17 12:09 id_rsa-rw-r -- r -- 1 WebAdmin 405 October 17 12:09 id_rsa.pub

 

2. Copy the content of id_rsa.pub and append it to the ~ of machine B ~ /. Ssh/authorized_keys file. You can manually copy the file or perform the following remote operations:

ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]10.10.10.123

 

3. Check/etc/ssh/sshd_config on machine B. Make sure the following configurations are valid:

RSAAuthentication yesPubkeyAuthentication yesAuthorizedKeysFile      .ssh/authorized_keys

 

4. Check ~ /. Ssh/authorized_keys permission, which must be 600. In fact, the permissions of group and others must be 0. If not, run

chmod 600 ~/.ssh/authorized_keys

 

5. If sshd_config is modified, restart the service:

service sshd restart

 

6. Test automatic SSH Login

ssh [email protected]10.10.10.123

If the configuration is successful, you do not need to enter the password.

 

SSH configuration Automatic Login

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.