Linux ssh password-free login, linuxssh password-free Login

Source: Internet
Author: User

Linux ssh password-free login, linuxssh password-free Login


Target: Local Machine ssh Login remote target machine without entering a password (by default, ssh requires a password)

Principle: PassPublic Key and Private KeyImplement system authentication

Implementation:Public KeyCopy to target machine



1. Generate a public key/private key pair on the local machine (skip this step if it has already been executed)

Ssh-keygen-t rsa

Or ssh-keygen-t rsa-p''

-P indicates the password.-P ''indicates that the password is empty, or you do not need the-P parameter. In this case, you have to press enter three times and press enter once with-P.

The command is in ~ The/. ssh/directory generates two files: id_rsa (Private Key) and (Public Key)


2. Copy the public key of the local machine to the target machine.

Method 1:


This command will copy the public key of the local machine to ~ /. Ssh/authorized_keys File


Method 2:

Scp ~ /. Ssh/ :~ /. Ssh/

Cat >> ~ /. Ssh/authorized_keys

(Or directly scp ~ /. Ssh/ :~ /. Ssh/authorized_keys)


3. Then, log on to the remote machine using ssh remote_host without the password.



Use ssh-keygen and ssh-copy-id to achieve SSH password-less Login

Ssh-keygen to generate key settings, so that ubuntu can log on to linux without a password

How to use ssh-keygen


Related Article

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: 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.