SSH password-free telnet to Linux

Source: Internet
Author: User

In fact, this problem online, the garden has a lot of blog introduction, but most of them ignore a problem, is to generate the public key is not to enter the password, tidy up:

1. There is a B two machine (Linux/unix), you want to telnet to B from A with SSH (assuming the respective ip,a:192.168.100;b:192.168.1.104).

2. On the A machine, use the "ssh-keygen-t RSA" command to generate the public key, note that this is always the return. Well, at this time under the "~/.ssh/" has been generated "Id_rsa, id_rsa.pub" two files.

3. Also on the A machine, the id_rsa.pub file just generated to copy to the B machine, you can use the command "SCP ~/.ssh/id_rsa.pub [email protected]:/home/root/", then the Id_ The Rsa.pub file was copied to the/home/root of Machine B.

4. Log on to the B machine with the root user and you will see the id_rsa.pub file that you just copied, using the command "cat id_rsa.pub >> ~/.ssh/authorized_keys" Add the public key of the A machine to the Authorized_keys file, (sometimes ~/does not have an. ssh folder or no Authorized_keys file, if so, create it yourself manually).

5. Also on the B machine, restart the sshd service, command "service ssh restart".

6. Back to the a machine, try, command "ssh [email protected]", no need to log in unexpectedly without a password!

Things to keep in mind:

1. ssh-keygen-t RSA to generate the public key, always enter the password is not entered, is the empty password.

2. To use which user remote login to copy the id_rsa.pub to the user corresponding path, such as: root user copied to/root/under; Andychen the user is copied to/home/andychen/, do not mix.

3. File permissions on machine B:. SSH folder (*); Authorized_keys (600).

SSH password-free telnet to Linux

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.