Telnet to Linux using the Putty key authentication mechanism

Source: Internet
Author: User

1. Download the Generate Key Tool putty kit inside the puttygen.exe

Putty Tool Small portable, do not need to install, you can use Baidu free download.


2, double hit Open puttygen.exe, the lower right corner "number of bits in a generated key" set to 2048, and then click "Generate", start to generate the key, move the mouse back and forth, you can quickly generate a key pair. "Key comment" will remain unchanged can also be customized, a simple introduction to the key, "key passphrase" to set a password for the key, the next time you use Telnet only need to enter this password to login to Linux;"Confim Passphrase" Re-enter the password you just set.


3, save the private key, click "Save private Key" in the pop-up box to choose to save the address of the private key, and the name is convenient to distinguish.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m01/5b/22/wkiom1t_4btth4dyaaljklsjf4w807.jpg "title=" qq20150311111135.jpg "alt=" wKiom1T_ 4btth4dyaaljklsjf4w807.jpg "/>


4. Copy the public key into the remote Linux

Back in the key generation window, a bunch of strings underneath "key" is the generated public key content, copied and pasted into the remote Linux/root/.ssh/authorized_keys file. If there is no. SSH directory, you need to build one yourself and change the directory permissions to 700

[[email protected] ~]# mkdir/root/.ssh[[email protected] ~]# chmod 700/root/.ssh/[[email protected] ~]# vi/root/.ssh/au Thorized_keys

Paste the contents of the public key and save the exit.


5. Turn off SELinux

If SELinux is not turned off, logging in with a key will prompt "Server refused our key"

There are two ways to turn off SELinux:

The SELinux firewall is temporarily closed and SELinux will open after the next reboot.

#setenforce 0

#getenforce #查看临时关闭selinux的状态命令

permanently close SELinux

#vi/etc/selinux/config #修改selinux的配置文件

Change "selinux=enforcing" to selinux=disabled Save exit.

[email protected] ~]# /usr/sbin/sestatus-v #查看selinux的状态命令
SELinux status:disabled


6. Turn off the firewall

[email protected] ~]# iptables-f #清空防火墙配置
[[email protected] ~]#/etc/init.d/iptables save #清空防火墙配置后, remember to save
Iptables: Save firewall Rules to/etc/sysconfig/iptables: [OK]


7. Set Putty Login via key

Open the Putty tool, select the left Connection--ssh--auth right "private key file for authentication" click "Browse" to select the previously saved private key file.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/5b/22/wkiom1t_4isiqribaai4rdtzr8u330.jpg "title=" qq20150311135102.jpg "alt=" wKiom1T_ 4isiqribaai4rdtzr8u330.jpg "/>


8. Log on to remote Linux with key authentication

Open the Putty interface, click on the Left "Session" dialog Window "Host Name" below to fill out the IP address of the remote Linux, "port" ports remain default to "Connection type" is the default SSH, "Saved Sessions "can be named after the session, easy to mark, fill in the right after the completion of the" Save "button, the next login will not have to enter again. Next login Select the saved session, click on the "Load" button on the right, load the settings, click "Open" to open the login screen after the configuration is complete.

Putty Interface "window"--translation option, Remote character set: Select UTF-8, avoid garbled;

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m02/5b/1c/wkiol1t_4dfdmg7waaihgpnwvtm731.jpg "title=" qq20150311140558.jpg "alt=" wKioL1T_ 4dfdmg7waaihgpnwvtm731.jpg "/>

Root User login, enter the password that was set when the key was generated, enter the interface as follows:

Login as:rootauthenticating with public key ' rsa-key-20150311 ' Passphrase for key ' rsa-key-20150311 ': Last login:wed Mar 1 1 19:26:27 from 192.168.20.1[[email protected]~]#


This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://8802265.blog.51cto.com/8792265/1619345

Telnet to Linux using the Putty key authentication mechanism

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.