SSH password-free login remote server configuration

Source: Internet
Author: User

Background: Setting up a Hadoop environment requires no password to log in, so-called no password login actually refers to the way to log in by certificate authentication, using a method called "Public private Key" authentication way to SSH login.

In Linux systems, SSH is the default tool for remote logins because the tool's protocol uses the RSA/DSA encryption algorithm. This tool is very secure for remote management of Linux systems. Telnet, because of its insecurity, is shelved in the Linux system.

"Public Private Key" authentication method Simple Explanation: First create a pair of public private key (public key file: ~/.ssh/id_rsa.pub; private key file: ~/.ssh/id_rsa) on the client. Then put the public key on the server (~/.ssh/authorized_keys) and keep the private key. When using SSH login, the SSH program sends the private key to match the public key on the server. If the match succeeds, you can log in.


    1. Generate secret Key

      Installation: OpenSSH rsync

      Generate secret key pair: Ssh-keygen-t rsa-p "

      File: Id_rsa id_rsa.pub default storage path/HOME/ABCD/.SSH

      Append the id_rsa.pub to the authorized key: Cat id_rsa.pub >> Authorized_keys

      Modify permissions for an authorized key: Chmod Authorized_keys

      To modify an SSH profile: vim/etc/ssh/sshd_config

      Remove Comment: rsaauthentication Yes

Pubkeyauthentication Yes

Authorizedkeysfile. Ssh/authorized_keys

Restart Services: Service sshd restart

Test: SSH localhost

2. Sending the public key to the server

SCP ~/.ssh/id_rsa.pub Remote User name @ Remote server ip:~/ ---Copy the public key to the ~/directory of the remote server

SCP ~/.ssh/id_rsa.pub [Email protected]:~/

3. Append the public key to the authorization key

cat ~/id_rsa.pub >> ~/.ssh/authorized_keys --Append public key to authorized key

To be safe, remove the public key

4. Back to client test: SSH 192.168.1.134

SSH password-free login remote server configuration

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.