Use SSH to log on without a password

Source: Internet
Author: User

Use SSH to log on without a password

SSH is a protocol designed for the security of remote logon sessions and other network services. By default, SSH connections require password authentication. You can add system authentication (Public Key-Private Key) modifications. After modification, inter-system switching can avoid password input and SSH authentication. The following describes the creation process.

1. Use SSH-keygen to create public/private key pairs

Ssh-keygen-tdsa-C jibo.tiger@gmail.com-f ~ /. Ssh/jibo.tiger@gmail.com

In the process, you may need to enter a password. In order to SSH access without a password, you can press enter directly.

2. view public/private key pairs

Ls ~ /. SSH

Jibo.tiger@gmail.com jibo.tiger@gmail.com.pub config

We can find two key files under the SSH directory.

Where jibo.tiger@gmail.com.pub is the public key, jibo.tiger@gmail.com is the private key

4. Copy the public key to the server host

SCP jibo.tiger@gmail.com.pub hostname @ I :~ /. Ssh/jibo.tiger@gmail.com.pub

5. Add the public key to the service host's trust

Cat jibo.tiger@gmail.com.pub> authorized_keys

Not: Step 4 and Step 5 can be completed by command ssh-copy-ID in one step

Ssh-copy-ID-I jibo.tiger@gmail.com.pub user @ IP

6. Set file and directory permissions:

Set authorized_keys Permissions
$ Chmod 600 authorized_keys
Set. Ssh Directory Permissions
$ Chmod 700-R. SSH

Summary

1. Do not set the file and directory permissions to chmod 777. This permission is too large, insecure, and not supported by digital signatures.

2. The generated RSA/DSA Signature public key is used by the other machine. The public key must be copied to authorized_keys.

3. Access between Linux instances through SSH hostname @ IP. If no hostname is specified, the local host name is used by default.

4. A machine generates its own RSA or DSA digital signature, sends the public key to the target machine, and then sets the relevant permissions (Public Key and authorized_keys permissions) after receiving the request ), the target machine can be accessed without a password by the machine that generates a digital signature.

 

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.