Linux ssh password-free login

Source: Internet
Author: User

Reprint Please specify source: http://www.cnblogs.com/blazer/p/5165304.html

I. Overview

1. In order to allow two Linux machines to use SSH between the user name and password is not required. Digital signature RSA or DSA is used to complete this operation.

2. Model Analysis

Suppose a (192.168.20.59) is a client machine, B (192.168.20.60) is the target machine;

To achieve the purpose:
A machine SSH login B machine does not need to enter a password;
Encryption mode RSA|DSA can be selected, the default DSA

Second, the specific operation process

The operation process of one-way landing (can satisfy the above purpose):
1. Log In a machine
2, Ssh-keygen-t [RSA|DSA], will generate a key file and a private key file id_rsa,id_rsa.pub or id_dsa,id_dsa.pub
3. Copy the. pub file to the. SSH directory of the B machine, and cat id_dsa.pub >> ~/.ssh/authorized_keys
4, finished, from a machine login B machine's target account, no longer need password; (direct running #ssh 192.168.20.60 )

Two-way landing operation process:

1, Ssh-keygen do password authentication can make in to the other side of the machine ssh, SCP does not use the password. The method is as follows:
2, two nodes perform the operation:#ssh-keygen-t RSA
Then all returns, with default values.

3, this generates a pair of keys, stored in the user directory ~/.ssh.
test the public key into the user directory of the other machine and copy it to ~/.ssh/authorized_keys (Operation command:#cat id_dsa.pub >> ~/.ssh/authorized_keys ).



4. Set file and directory permissions:

Set Authorized_keys Permissions
$ chmod Authorized_keys
Set the. SSH directory permissions
$ chmod 700-r. SSH

Permissions to set/home/${user name}

$ chmod 700-r/home/${user name}

Linux ssh password-free 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.