Ssh password-less Login Server

Source: Internet
Author: User

There are many tutorials on the Internet, but they are recorded for later use.

The Intranet ip addresses of the two servers are:

172.16.3.91 (Local Machine)

172.16.3.92 (remote host)

Now I want to log on to the remote machine through ssh 172.16.3.92 on the local machine without a password.

1. Use ssh-keygen to create the public key and private key on the local machine.

[Root @ RS-1 ~] # Ssh-keygen-t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/root/. ssh/id_rsa ):

Enter passphrase (empty for no passphrase ):

Enter same passphrase again:

Your identification has been saved in/root/. ssh/id_rsa.

Your public key has been saved in/root/. ssh/id_rsa.pub.

The key fingerprint is:

Dc: fc: ea: b8: bb: 74: d7: 75: 4b: 6a: 27: 82: 28: 27: be: d6 root @ RS-1

In this process, you will be prompted to enter the password. Remember to press enter directly. Do not enter the password! If you have entered the password, you need to enter the password for access later.

After creation, you can see the following two files:

[Root @ RS-1. ssh] # ll

Total 24

-Rw ------- 1 root 1675 May 8 07:18 id_rsa

-Rw-r -- 1 root 391 May 8 id_rsa.pub

Id_rsa is the private key.

Id_rsa.pub is a public key, mainly used by remote machines.

2. Upload the public key to the remote machine.

[Root @ RS-1. ssh] # scp id_rsa.pub root@172.16.3.92 :~ /. Ssh/authorized_keys

Address 172.16.3.92 maps to localhost, but this does not map back to the address-possible break-in attempt!

Root@172.16.3.92's password:

Id_rsa.pub 100% 391 0.4KB/s

3. You do not need a password when connecting to the ssh client. You can directly log on to the remote server.

[Root @ RS-1. ssh] # ssh 172.16.3.92

Address 172.16.3.92 maps to localhost, but this does not map back to the address-possible break-in attempt!

Last login: Thu May 8 07:19:28 2014 from 172.16.3.91

[Root @ RS-2 ~] #

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.