How to Set ssh password-free logon using the public key in linux

Source: Internet
Author: User
Tags free ssh
When an administrator wants to manage dozens of hundreds or even thousands of servers, the trouble is that every time a server is connected, a single password can be exhausted. In fact, the linux Public Key can achieve password-free ssh Login Password-free settings are as follows: (1) generate a Public Private Key under the hadoop user of the masters machine: ssh-keygen-trsa-f

When an administrator wants to manage dozens of hundreds or even thousands of servers, the trouble is that every time a server is connected, a single password can be exhausted.

In fact, the linux Public Key can achieve password-free Login


The ssh password-free settings are as follows:
(1) generate a public/private key under the hadoop user of the masters machine: ssh-keygen-t rsa-f ~ /. Ssh/Id_ Rsa
Note: When ssh-keygen generates a public/private key, it will ask Enter passphrase (empty for no passphrase): # enter is skipped directly, and password will not be asked next time.
(2) copy the generated id_dsa.pub to all the remote machines to be connected in the same path: sCp~ /. Ssh/id_rsa.pub hadoop @ [ip]:/home/hadoop/. ssh
(3) Add the public keyCluster. Ssh/authoriz under all machine User DirectoriesEdIn _ keys:Cat~ /. Ssh/id_rsa.pub> ~ /. Ssh/authorized_keys
(4) During ssh connection, the private key (id_rsa) of the local computer performs authentication with the public key (authorized_keys) of the remote computer. After confirmation, you can log on directly without entering the account password, it is also safe.
NOTE: If there is no. ssh folder in the user directory, you can create it manually. Otherwise, the account ssh localhost will be automatically created once.
 

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.