Secure and Xshell set key Login server

Source: Internet
Author: User

The secure client logs into the server via a key:

1. Secure Client Settings

Generate key

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8C/1A/wKioL1hiT2_i5IZJAABxAlPoYyA079.png-wh_500x0-wm_3 -wmp_4-s_1034965126.png "title=" 1.png "alt=" Wkiol1hit2_i5izjaabxalpoyya079.png-wh_50 "/>


Click Next:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8C/1A/wKioL1hiT7iiekfsAABJRFgGaWk536.png-wh_500x0-wm_3 -wmp_4-s_1411783971.png "title=" 2.png "alt=" Wkiol1hit7iiekfsaabjrfggawk536.png-wh_50 "/>


Select the encryption type:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8C/1A/wKioL1hiT9iQXgGMAABRje2h-gc283.png-wh_500x0-wm_3 -wmp_4-s_2294518974.png "title=" 3.png "alt=" Wkiol1hit9iqxggmaabrje2h-gc283.png-wh_50 "/>


Enter your login password and click Next:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8C/1F/wKiom1hiZTLwIvVHAABWQUZtToQ073.png-wh_500x0-wm_3 -wmp_4-s_3914129442.png "title=" 4.png "alt=" Wkiom1hiztlwivvhaabwquzttoq073.png-wh_50 "/>


Encryption Length (default 1024), Next:

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8C/1B/wKioL1hiZUvSMZMXAABWKz8eU3I366.png-wh_500x0-wm_3 -wmp_4-s_923355374.png "title=" 5.png "alt=" Wkiol1hizuvsmzmxaabwkz8eu3i366.png-wh_50 "/>


Next:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8C/1F/wKiom1hiZaPySU_YAABOSyFTesM492.png-wh_500x0-wm_3 -wmp_4-s_694587893.png "title=" 6.png "alt=" Wkiom1hizapysu_yaabosyftesm492.png-wh_50 "/>


Build path, Complete:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8C/1B/wKioL1hiZbbzswx1AABguIj34xk348.png-wh_500x0-wm_3 -wmp_4-s_2673711315.png "title=" 7.png "alt=" Wkiol1hizbbzswx1aabguij34xk348.png-wh_50 "/>


Determines whether the global public key for this client, if there is no other public key, is the point, otherwise point no;

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8C/1B/wKioL1hiZeijM5tVAABMpviSB_4206.png-wh_500x0-wm_3 -wmp_4-s_2533172606.png "title=" 9.png "alt=" Wkiol1hizeijm5tvaabmpvisb_4206.png-wh_50 "/>



2. Server Client settings:

Write Public key

There are two files in the generated key, a public key file (Identity.pub), and a private key (Identity).

The content within the identity.pub needs to be written to a specific file in the Linux server: ~/.ssh/authroized_keys

where "~" represents the corresponding user's home directory, with Root as an example. If you are logged in with a test user, you need to copy the identity.pub to/home/test/.ssh. If the. SSH directory does not exist, create it and write the public key information to the file:

[Email protected] ~]# mkdir ~/.ssh

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

[email protected] ~]# Touch ~/.ssh/authorized_keys

[Email protected] ~]# chmod 644 ~/.ssh/authorized_keys

[Email protected] ~]# ssh-keygen-i-F you_identity.pub >>/root/.ssh/authorized_keys #将公钥导入到 Authoriz In the Ed_keys file

Note: It is important to note that ~/.SSH's new must be 700,~/.ssh/authorized_keys must be 644, otherwise it may not be possible to log in.


2, modify the/etc/ssh/sshd_config file, save the exit (esc+ input ": wq!" ), restart the SSHD service (service sshd restart)

Vim/etc/ssh/sshd_config

Rsaauthentication Yes

Pubkeyauthentication Yes

Authorizedkeysfile. Ssh/authorized_keys

Remove the above three previous # numbers and save the exit.

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8C/1F/wKiom1hiZjKQoXi-AAAfdHTihB8184.png-wh_500x0-wm_3 -wmp_4-s_2778800101.png "title=" 11.png "alt=" Wkiom1hizjkqoxi-aaafdhtihb8184.png-wh_50 "/>


3. Client Settings

Create a new session, fill in the IP, port, user name (USERNAME), authentication keys to the top key;

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/8C/1B/wKioL1hiZkiCRS8kAAC62pxMCCw442.png-wh_500x0-wm_3 -wmp_4-s_848689528.png "title=" 12.png "alt=" Wkiol1hizkicrs8kaac62pxmccw442.png-wh_50 "/>


*****************************************************************************************************

Second, Xshell login settings

Create a new user key:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/8C/1F/wKiom1hiZuXQssV0AACxy75dzH0953.png-wh_500x0-wm_3 -wmp_4-s_229403023.png "title=" 21.png "alt=" Wkiom1hizuxqssv0aacxy75dzh0953.png-wh_50 "/>


Select DSA and click Next:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/8C/1B/wKioL1hiZvmx-soMAAC2fT4gXoU583.png-wh_500x0-wm_3 -wmp_4-s_429133385.png "title=" 22.png "alt=" Wkiol1hizvmx-somaac2ft4gxou583.png-wh_50 "/>


Next:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8C/1F/wKiom1hiZwvysokMAACvOjsGMTE134.png-wh_500x0-wm_3 -wmp_4-s_2935296107.png "title=" 23.png "alt=" Wkiom1hizwvysokmaacvojsgmte134.png-wh_50 "/>


Fill in the login password, Next:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8C/1F/wKiom1hiZ1TysNqAAACpzFTNP0Q844.png-wh_500x0-wm_3 -wmp_4-s_1024967128.png "title=" 24.png "alt=" Wkiom1hiz1tysnqaaacpzftnp0q844.png-wh_50 "/>


Export the public key, complete,

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8C/1F/wKiom1hiZ2WBIOEAAADmhTluvpc568.png-wh_500x0-wm_3 -wmp_4-s_122704011.png "title=" 25.png "alt=" Wkiom1hiz2wbioeaaadmhtluvpc568.png-wh_50 "/>


Export the private key, then close; (It is recommended that the export be saved with the public key in case the reload of the software will be rebuilt later)

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8C/1B/wKioL1hiZ3XDrZE4AABQolcDCWM455.png-wh_500x0-wm_3 -wmp_4-s_3965087547.png "title=" 26.png "alt=" Wkiol1hiz3xdrze4aabqolcdcwm455.png-wh_50 "/>


2: Server

Write Public key

There are two files in the generated key, a public key file (Id_dsa_1024.pub), and a private key (id_dsa_1024).

The content within the id_dsa_1024.pub needs to be written to a specific file in the Linux server: ~/.ssh/authroized_keys

where "~" represents the corresponding user's home directory, with Root as an example. If you are logged in with a test user, you need to copy the id_dsa_1024.pub to/home/test/.ssh. If the. SSH directory does not exist, create it and write the public key information to the file:

[Email protected] ~]# mkdir ~/.ssh

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

[email protected] ~]# Touch ~/.ssh/authorized_keys

[Email protected] ~]# chmod 644 ~/.ssh/authorized_keys

[email protected] ~]# cat id_dsa_1024.pub >>/root/.ssh/authorized_keys #将公钥追加到 authorized_keys file

Note: It is important to note that ~/.SSH's new must be 700,~/.ssh/authorized_keys must be 644, otherwise it may not be possible to log in.


To modify the login method:

Vim/etc/ssh/sshd_config

Rsaauthentication Yes

Pubkeyauthentication Yes

Authorizedkeysfile. Ssh/authorized_keys

Remove the above three previous # numbers and save the exit.

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8C/1F/wKiom1hiZjKQoXi-AAAfdHTihB8184.png-wh_500x0-wm_3 -wmp_4-s_2778800101.png "title=" 11.png "alt=" Wkiom1hizjkqoxi-aaafdhtihb8184.png-wh_50 "/>


3. Xshell Client

Configure IP, port

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8C/1F/wKiom1hiZ-2hGivSAACdef5WEbE228.png-wh_500x0-wm_3 -wmp_4-s_1653144976.png "title=" 42.png "alt=" Wkiom1hiz-2hgivsaacdef5webe228.png-wh_50 "/>


Select key login, user name, key file and key password;

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8C/1F/wKiom1hiaGeBqFnXAACoU_b_x5w278.png-wh_500x0-wm_3 -wmp_4-s_3107427906.png "title=" 43.png "alt=" Wkiom1hiagebqfnxaacou_b_x5w278.png-wh_50 "/>

Secure and Xshell set key Login server

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.