"Reprint" SSH login without password password-free login

Source: Internet
Author: User

Your Aim

You want the use of Linux and OpenSSH to automate your tasks. Therefore need an automatic login from host A/user A to host B/user B. You don't want to enter any passwords, because you want to call ssh from a within a shell script.

How to do it

First log in on a as user A and generate a pair of authentication keys. Do not enter a passphrase:

[Email protected]:~> ssh-keygen-t rsagenerating public/private RSA key pair. Enter file in which to save the key (/HOME/A/.SSH/ID_RSA): Created directory '/home/a/.ssh '. Enter passphrase (empty for no passphrase): Enter same passphrase Again:your identification have been saved IN/HOME/A/.SS H/id_rsa. Your public key has been saved in/home/a/.ssh/id_rsa.pub.the key fingerprint is:3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37: bc:37:e4 [email protected]

Now use ssh to create a directory ~/.ssh as User B on B. (the directory may already exist, which is fine ):

Finally append a ' s new public key to [e-mail Protected]:.ssh/authorized_keys and enter B ' s password one last time:

From now on you can log into B as B from a as a without password:

[Email protected]:~> ssh [email protected]

A Note from one of our readers:depending in your version of SSH you might also has to do the following changes:

    • Put the public key in . Ssh/authorized_keys2
    • Change the permissions of . SSH to
    • Change the permissions of . Ssh/authorized_keys2 to 640

"Reprint" SSH login without password 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.