Use a plaintext ssh password to log on to a remote server on a linux Desktop

Source: Internet
Author: User

Use a plaintext ssh password to log on to a remote server on a linux Desktop
1. The safest way to log on to a remote server in linux is password-free login. 2. Principle

Implemented through public key encryption and Private Key decryption.

The User Machine sub-stores the private key and the remote machine sub-stores the corresponding public key.

The remote host uses the public key to encrypt a piece of text for the user.
The user's machine uses the private key to decrypt and obtain the "text", which is then sent to the remote machine in plaintext format.
If the text information received by the remote host is consistent with the text information, the user is trusted, that is, the user is a real user.

Implementation 1

First, log on to the remote host through ssh, and name it DEV. (Ssh yansong @ dev, and then enter the password to log on)
Cd ~ & Cd. ssh // enter the personal environment and try to enter the. ssh directory
If the. ssh directory does not exist, create it (mkdir. ssh)
Ls // check whether the id_rsa and id_rsa.pub files exist in the. ssh directory.
If the preceding two files do not exist, create them (enter ssh-keygen-t rsa, press enter, and press Enter)
Cat id_rsa.pub> authorized_keys // copy the public key to the location where the verification key file is stored.
Chmod 600 authoried_keys // rw ---
Scp yansong @ dev:. ssh/id_rsa *~ //. Ssh // copy id_rsa and id_rsa.pub to the corresponding ~ /. Ssh directory

Implementation 2

Use the plaintext password.
Install sshpass first

Sudo apt-get install sshpass

Then use
Sshpass-p 'Password' ssh remote machine username @ remote machine ip-C

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.