Using Putty Remote Linux Services

Source: Internet
Author: User

Since the CentOS system has been installed before, can operate or configure the server, but sometimes because the server in the computer room or other places, we need to connect the past through the remote way, then we use Putty to connect the Linux service, and do some simple settings:

The private key and the public key are paired, there will be private key encryption, public key decryption, the private key is stored locally, the public key is stored on the server, when the local connection to the remote server, the private key to the data encryption, and then to the remote, with the remote public key to decrypt a process.

1, download putty software, Baidu Cloud address as follows:

Link: http://pan.baidu.com/s/1eServv8 Password: vhd2

1, after downloading the software, click Putty.exe, open the Putty login interface:

Enter the IP address, port number, name, and the last connection:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/08/BB/wKiom1nmMhCwcgrWAADsbkyDaWU816.png-wh_500x0-wm_ 3-wmp_4-s_364413220.png "title=" 1.png "alt=" wkiom1nmmhcwcgrwaadsbkydawu816.png-wh_50 "/>650) this.width=650;" Src= "Https://s5.51cto.com/wyfs02/M00/A7/6A/wKioL1nmL2WT9dVFAADsbkyDaWU987.png-wh_500x0-wm_3-wmp_4-s_ 4183012985.png "title=" 1.png "alt=" Wkiol1nml2wt9dvfaadsbkydawu987.png-wh_50 "/>

2. Unzip the file after downloading, click Puttygen.exe: Generate Secret key:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/A7/6A/wKioL1nmL3yg22N0AABVDpIv73A138.png-wh_500x0-wm_ 3-wmp_4-s_4052321767.png "title=" 2.png "alt=" Wkiol1nml3yg22n0aabvdpiv73a138.png-wh_50 "/>

3, click Generate, generate the public key (note, need to move the mouse over the public key, you can load faster), the public key to be placed on the Linux server.

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/08/BB/wKiom1nmMjyjoyaYAAELQQFUCbs570.png-wh_500x0-wm_ 3-wmp_4-s_244142056.png "title=" 3.png "alt=" Wkiom1nmmjyjoyayaaelqqfucbs570.png-wh_50 "/>

4. Create a directory on a Linux server ./root/.ssh, and new text . Ssh/authorized._keys.

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/08/BB/wKiom1nmMkegHt_nAABFiNqi3eI435.png-wh_500x0-wm_ 3-wmp_4-s_1490554556.png "title=" 4.png "alt=" Wkiom1nmmkeght_naabfinqi3ei435.png-wh_50 "/>

Because. SSH is a hidden file, you need to add ls-a to view it.

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/A7/6A/wKioL1nmL5_hNe2zAABBzN7Js4k106.png-wh_500x0-wm_ 3-wmp_4-s_1825543070.png "title=" 5.png "alt=" Wkiol1nml5_hne2zaabbzn7js4k106.png-wh_50 "/>

5. Copy the secret key generated by Puttygen to the server/root/.ssh/authorized_keys text:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/A7/6A/wKioL1nmL7ry03qyAADaDkQUZ_w615.png-wh_500x0-wm_ 3-wmp_4-s_3230677311.png "title=" 6.png "alt=" Wkiol1nml7ry03qyaadadkquz_w615.png-wh_50 "/>

Open the Vi/root/.ssh/authorized_keys text and copy the public key in:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/08/BB/wKiom1nmMoGyE29xAAAhp0DN6B4525.png-wh_500x0-wm_ 3-wmp_4-s_3686261010.png "title=" 7.png "alt=" wkiom1nmmogye29xaaahp0dn6b4525.png-wh_50 "/>650) this.width=650;" Src= "https://s4.51cto.com/wyfs02/M01/A7/6A/wKioL1nmL9iy9mTYAAAhp0DN6B4958.png-wh_500x0-wm_3-wmp_4-s_746914851. PNG "title=" 7.png "alt=" Wkiol1nml9iy9mtyaaahp0dn6b4958.png-wh_50 "/>

Copy it over:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/08/BB/wKiom1nmMpjS6F6PAAD1duKvyAc613.png-wh_500x0-wm_ 3-wmp_4-s_278823131.png "title=" 8.png "alt=" Wkiom1nmmpjs6f6paad1dukvyac613.png-wh_50 "/>

6, when the public key is saved on the server, we also need to save the private key locally: The following:

or open the Puttygen before you run this software: Save:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/A7/6A/wKioL1nmL-3TdhAkAAA86Q6qvOo968.png-wh_500x0-wm_ 3-wmp_4-s_3759708285.png "title=" 9.png "alt=" Wkiol1nml-3tdhakaaa86q6qvoo968.png-wh_50 "/>

7, this time need to associate the public key and private key together, open the file Putty.exe before decompression.

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/08/BB/wKiom1nmMq-isqTXAADxRiMkkFs364.png-wh_500x0-wm_ 3-wmp_4-s_397598861.png "title=" 10.png "alt=" Wkiom1nmmq-isqtxaadxrimkkfs364.png-wh_50 "/>

Click Add Private key, plus where is the ssh:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/08/BB/wKiom1nmMs-ybCfBAAGszdCD0YM752.png-wh_500x0-wm_ 3-wmp_4-s_3287871943.png "title=" 11.png "alt=" Wkiom1nmms-ybcfbaagszdcd0ym752.png-wh_50 "/>

8, after the completion of the addition, return to the top session to save a bit:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/A7/6A/wKioL1nmMHGy1JI8AADFcUPKm34788.png-wh_500x0-wm_ 3-wmp_4-s_3115656352.png "title=" 12.png "alt=" Wkiol1nmmhgy1ji8aadfcupkm34788.png-wh_50 "/>

9, in order to secure the Linux key, you also need to set permissions:

[Email protected] ~]# chmod 700/root/.ssh/

[Email protected] ~]# chmod 600/root/.ssh/authorized_keys

You also need to turn off the firewall at this point, because CentOS 7.0 defaults to using firewall as the firewall, Iptables is not installed.

Firewall-cmd--state View the status of firewall:

[Email protected] ~]# Systemctl stop Firewalld.service

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/08/BB/wKiom1nmMwny2lLqAAC62FQRooE083.png-wh_500x0-wm_ 3-wmp_4-s_1137244476.png "title=" 14.png "alt=" Wkiom1nmmwny2llqaac62fqrooe083.png-wh_50 "/>

10, also need to close selinux:, about SELinux There are two ways, one is temporary shutdown, as follows:

[Email protected] ~]# Getenforce 0

Enforcing

The second type is permanently closed: open Vi/etc/selinux/config, modify to Diabled, or close.

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/08/BB/wKiom1nmM0riqjGyAAC8_RHg8WI019.png-wh_500x0-wm_ 3-wmp_4-s_197383896.png "title=" 15.png "alt=" Wkiom1nmm0riqjgyaac8_rhg8wi019.png-wh_50 "/>

11, at this time has been set to complete: You can open the Putty,exe client to connect to the server:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/08/BB/wKiom1nmM2LDnw--AAEC8ss9xFI733.png-wh_500x0-wm_ 3-wmp_4-s_1494159419.png "title=" 16.png "alt=" Wkiom1nmm2ldnw--aaec8ss9xfi733.png-wh_50 "/>

Connect again, enter the root user name can be, do not need to enter a password:

PostScript

1, modify the sshd port number:

1, open Vi/etc/ssh/sshd_config, modify the port number, and then save:

[Email protected] ~]# Vi/etc/ssh/sshd_config

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/A7/6A/wKioL1nmMLbBOlIHAACh-W9GxX4026.png-wh_500x0-wm_ 3-wmp_4-s_521595831.png "title=" 17.png "alt=" Wkiol1nmmlbbolihaach-w9gxx4026.png-wh_50 "/>

2. Then reboot to shut down the firewall: Sysctemctl stop firewalld.service.

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/A7/6A/wKioL1nmMMHwDngIAABOYnBf7FM196.png-wh_500x0-wm_ 3-wmp_4-s_64567497.png "title=" 18.png "alt=" Wkiol1nmmmhwdngiaaboynbf7fm196.png-wh_50 "/>

You can log in again at this time.

2, modify only allow the root user login: Modify/etc/ssh/sshd_chonfig. Modify Permitrootlogin Yes.

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/A7/6A/wKioL1nmMPWyAz_WAABKfmCPUCI467.png-wh_500x0-wm_ 3-wmp_4-s_1036258483.png "title=" 19.png "alt=" Wkiol1nmmpwyaz_waabkfmcpuci467.png-wh_50 "/>

3, set only allow to use the secret key login, do not allow password logon:

Modify the/etc/sshd/sshd_config. Set Passwordauthenticaiton Yes.

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/08/BB/wKiom1nmM5fAcS0_AAALlVPg-5g313.png-wh_500x0-wm_ 3-wmp_4-s_1084255220.png "title=" 20.png "alt=" Wkiom1nmm5facs0_aaallvpg-5g313.png-wh_50 "/>

Modify the/etc/sshd/sshd_config. Set Pubkeyauthenticaiton Yes.

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/A7/6A/wKioL1nmMR7S54YkAAA5BFFelPo175.png-wh_500x0-wm_ 3-wmp_4-s_2655222376.png "title=" 21.png "alt=" Wkiol1nmmr7s54ykaaa5bffelpo175.png-wh_50 "/>

    • Password login is not allowed at this time, only secret key login.


This article is from the "_de blog" blog, be sure to keep this source http://yuanhaohao.blog.51cto.com/7714752/1973595

Using Putty Remote Linux Services

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.