How to connect to an SSH client without a password

Source: Internet
Author: User

This simple tutorial explains how to connect to a remote machine without entering a password for SSH. This technology can be used when you need to log on to the same machine frequently and have to enter the password again and again. This is also suitable for such scenarios: When you have a script that needs to retrieve files from a remote machine through SSH or execute a task on the remote machine, and want to run the script automatically, instead of entering a password manually.
These commands work normally in Linux and Mac. You can use Putty in the same way in Windows, but I didn't describe the specific Putty command here.
Target: no password is required for logging on to the remote server from the local machine.

Step 1/2: generate a verification code on the local machine
The authentication code is a private key pair. Your public key is also a 2-3-line long line that cannot understand things. The Public Key is like the unique identifier after you log on. The private key is like your password, but it is longer than the password of a rule. You can use the following command to generate your public key and private key:
 1.ssh-keygen -t rsa
1.Generating public/private rsa key pair.
Enter file in which to save the key (/home/vineetmanohar/.ssh/id_rsa:

Accept the default options.Press ENTER.
1.Enter passphrase (empty for no passphrase): 2.Enter same passphrase again:
Press ENTER twice. Passphrase is used to encrypt your private key. No one can understand it after encryption. However, if you want to log on without a password, you cannot encrypt your private key.1.The key fingerprint is: 2.5e:26:52:34:a1:22:18:68:11:11:7d:8d:c6:d5:4b:bf vineetmanohar@vineetmanohr.com
What have you just done?
On your local machine ~ /. In the ssh directory, you have created two files.
1.cd ~/.ssh2.ls -l
1.-rw------- 1 vineetmanohar vineetmanohar 1675 2009-07-17 17:27 id_rsa    2.-rw-r--r-- 1 vineetmanohar vineetmanohar  411 2009-07-17 17:27 id_rsa.pub
Id_rsaContains your private key.Id_rsa.pubContains your public key.
Step 2/2: log on to a remote machine: authenticate login without a password
Log on to a remote machine
1.ssh hostname -l username
1.The authenticity of host vineetmanohar.com (XXX.XXX.XXX.XX) cant be established.    2.RSA key fingerprint is 44.2b:93:ce:1b:1b:99:3a:6d:91:d1:50:aa:0d:87:40.    3.Are you sure you want to continue connecting (yes/no)?
InputYesAnd press ENTER
1.Warning: Permanently added vineetmanohar.com,XXX.XXX.XXX.XX (RSA) to the list of known hosts.    2.username@vineetmanohar.coms password:
Enter the password and press Enter.
A. sh directory is created on the remote machine and A. authorized_keys file is generated. Copy all the content in id_rsa.pub on your local machine and paste it to The. authorized_keys file of the remote server.
01.mkdir .ssh02.chmod 700 .ssh03.cd .ssh04.

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.