Create key logins on Windows via SECURECRT and putty

Source: Internet
Author: User

The above describes the SSH telnet protocol of Linux and SSH login without password, here in Windows through SECURECRT and Putty login Linux to see the specific key creation, configuration and login, also count as a memo it.

Create a key pair under 1.linux

Remember what you said earlier how to create a key pair:

[Email protected] ~]$ ssh-keygen-t rsagenerating public/private RSA key pair. Enter file in which to save the key (/HOME/SSHTEST/.SSH/ID_RSA): Created directory '/home/sshtest/.ssh '. Enter passphrase (empty for no passphrase): Enter same passphrase Again:your identification have been saved In/home/sshte St/.ssh/id_rsa. Your public key has been saved in/home/sshtest/.ssh/id_rsa.pub.the key fingerprint is:22:e4:e8:60:24:b5:ac:bd:53:52:4a: b1:08:a0:e9:7b [email protected]the key ' s randomart image is:+--[RSA 2048]----+|+ o              | | o= +             | | =.= o            | | ++ *             || Oo= +. S        | |. o.+. .         || . +e             | |  |                 +-----------------+

If you want to log in without losing the password to create a key, then the above directly enter, do not lose. After performing this process, our key pair was created successfully in the. SSH hidden directory. Viewing found two files, a private key id_rsa, a public key id_rsa.pub, and then we output the contents of the public key to a file called Authorized_keys:

[[Email protected] ~]$ CD. Ssh/[[email protected]. ssh]$ lsid_rsa  id_rsa.pub[[email protected]. ssh]$ Cat Id_rsa.pub & gt;> Authorized_keys[[email protected]. ssh]$ lsauthorized_keys  id_rsa  id_rsa.pub

Why output to Authorized_keys file, also said before, because in the/etc/ssh/sshd_config file is configured, the default is Authorized_keys file, if there are a lot of public key, will be output to this file. Then we put the private key id_rsa out in one of our Windows directory, the key login needs this thing, and finally restart the sshd service,/etc/init.d/sshd restart success, We can log on to a Linux user on Windows with software such as SECURECRT or putty, which is the user who authorized_keys the file.

1). SECURECRT Login

Run the SECURECRT software, enter the IP address of the host to log in to, port, if not specifically set to default to 22 and the user name to log on to the user, Then just tick PublicKey in the authentication option or refer to the PublicKey option, then select it and click Properties:



Click this button in the Pop-up dialog box to select the private key you copied, click OK, then click the Connect button on the current form:



Finally, you are prompted to enter the password to create the key, if it is set:



This allows us to log in to the specified user in Linux:



This process must remember to set the. SSH directory permission to 700, set the permissions of the Authorized_keys file to 600, or it will be an error:



2). Putty Login

With putty a little bit of trouble, you need to download a name called Puttygen to convert the private key format, the previous operation is the same, create a key pair, and then modify the permissions, copy the private key to a directory in Windows. The Putty private key has a different format, so you need to Puttygen to convert it. To run the Puttygen software, click Load to select the private key to be copied:



If you cannot find your private key file, click on the file type in the lower right corner and select Show all files, because the private key file is generated under Linux with no extension:



After selecting the private key, you are prompted for the password that was set when the key was created, if set:



The conversion succeeds, next we need to save the private key file generated after our conversion format, click the Save Private Key button to save:



Putty's private key extension is. PPK, when you find that the private key file has been saved successfully, then you use the Putty key to log in:


Run Putty software, select Connection->ssh->auth on the left click the Browse button to select the private key file generated after the conversion format. PPK:



Then on the left, select session input to log in to the host Linux IP and port, click Open:



Finally enter the user name of the user to log in and the password that is set when the private key is created, if set:



2.windows SecureCRT and Putty create key pair

Previously, the key pair created in Linux is now chosen to create the key pair with SECURECRT and putty, then upload the public key to the host and then log in with the key. Suppose we have uploaded the public key to the host as key.pub, not directly output to the Authorized_keys as above, must be converted to OpenSSH recognizable format, here ssh-keygen-i-F key.pub >> The Authorized_keys,authorized_keys file must be 600 and be present in the. SSH hidden file, if it is not created, has a permission of 700, and finally restarts the SSHD service/etc/init.d/sshd restart . Here's a look at two ways to create a key pair and how to log in as a key.

1). SECURECRT Create and Login

Run the SECURECRT software, select PublicKey as above, then click Properties to create the key pair by selecting Create Identity file in the popup dialog box:



Then next, select the algorithm DSA or RSA and set the key password again next, set the key length default 1024 next to Next, select the location where the key pair is saved, default is upload in my document, and select No. The key pair is then generated, the private key is identity, and the public key is identity.pub:



Copy the public key to the Linux host to perform the above red section in the user directory where we want to log in, and then log in by PublicKey to specify the identity private key file that we generated.

2). Putty Create and Login

Putty Create key pair or rely on Puttygen this software, run Puttygen software, click the Generate button, automatically create a key pair. You can also set the length of the key, which defaults to 2048,1024 faster than the 2048 creation. After creation, you can see the contents of the public key, then set the key password, save the public and private keys, and then upload the public key to the host to perform the red section above, or just save the private key and then copy the public key contents to the Authorized_keys file of the Linux host:


Finally, run putty and specify the private key login.

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