One, the key way to log on to the device.
In general, we use the account and password to log on to the device, but there will be a problem. That is, in the case of batch management, you may do the relevant configuration every time, on all devices, the account number and password login again. Therefore, a key pair is required to log on to the device, the so-called key pair, is to produce a pair of keys, one is the private key, and the other is the public key. Private key encryption, public key encryption. We typically use Xshell and SECURECRT to generate a key pair, the private key is saved to itself, and the public key is passed to the server. Make the relevant configuration, you can login the device with secret account and password. See below for specific actions
First look at securecrt how to use:
First step: Create a key
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/97/81/wKiom1kvV6eRgSh4AADcwi0RxuI625.jpg-wh_500x0-wm_ 3-wmp_4-s_4127143014.jpg "title=" snap1.jpg "alt=" Wkiom1kvv6ergsh4aadcwi0rxui625.jpg-wh_50 "/>
Select Next:
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/97/81/wKiom1kvV-3DYN05AADfqN32DvA994.jpg-wh_500x0-wm_ 3-wmp_4-s_2794368404.jpg "title=" snap2.jpg "alt=" Wkiom1kvv-3dyn05aadfqn32dva994.jpg-wh_50 "/>
Select RSA: I am personally accustomed to using RSA authentication methods
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/97/81/wKiom1kvWCCBXMXbAADPsCwKR6Q600.jpg-wh_500x0-wm_ 3-wmp_4-s_3804996878.jpg "title=" snap3.jpg "alt=" Wkiom1kvwccbxmxbaadpscwkr6q600.jpg-wh_50 "/>
To continue to the next step, you can fill in the content, I generally next here:
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/97/83/wKioL1kvWGLzsYcZAADn-IBHI7g055.jpg-wh_500x0-wm_ 3-wmp_4-s_3501966594.jpg "title=" snap4.jpg "alt=" Wkiol1kvwglzsyczaadn-ibhi7g055.jpg-wh_50 "/>
Select default 1024, if you want the key length longer, you can fill in 2048
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/97/82/wKiom1kvWKrw1sgEAADY6rGeLjU721.jpg-wh_500x0-wm_ 3-wmp_4-s_3934381295.jpg "title=" snap5.jpg "alt=" Wkiom1kvwkrw1sgeaady6rgelju721.jpg-wh_50 "/>
This time, start generating the key.
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/97/83/wKioL1kvWQmR9NiRAAECCrMrUs4563.jpg-wh_500x0-wm_ 3-wmp_4-s_1502864942.jpg "title=" snap6.jpg "alt=" Wkiol1kvwqmr9niraaeccrmrus4563.jpg-wh_50 "/>
Choose the OpenSSH key format, and Figure 2 is the private key and the public key stored in your local directory. Finally, click Finish. Generate the key. The following steps, all selected are. We can.
Then go to 2 in the directory and find
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/97/83/wKioL1kvWavz4imaAABsUUqVXTE195.jpg-wh_500x0-wm_ 3-wmp_4-s_402380039.jpg "title=" snap1.jpg "alt=" Wkiol1kvwavz4imaaabsuuqvxte195.jpg-wh_50 "/>
Locate the Identiy.pub public key file and use Word to open and copy the contents. This is what the public key produces. Then log in to the server you need to log in. Place the public key on the server.
Here's how the server is Related:
[Email protected] ~]# mkdir-p/root/.ssh
[Email protected] ~]# Vi/root/.ssh/authorized_keys
Inside content: is the content of above identiy.pub
[Email protected] ~]# Cat/root/.ssh/authorized_keys
Sh-dss aaaab3nzac1kc3maaacbapc8thllxeqccofadjumd6fqxqfemj51fwh1wwdfsw9lrhsnjbrsf91kusi3igtekaqqxahimmtcpqk/ zi9rugtaklc32uspm+asbsxgvu8rnuj7jkt9uwosdpgcuu9mds9g9rxcxtklbq9omhaij1jnh6qsa/xo/vejtm+ eb1y7aaaafqcmlz5kbtn7t1pm6x5asv/ xfqqqkwaaaiea3ent12q7ho0ptwo8algvkkzc6ovj6eiknzncankondxoih3qwogoxoqrufbbwxo7b8sz/wo2oz1v/y/ ne2lknhmguzgibkr4qqxhgo9uczmake7fxx50r7u4gtmjonwy5f0yysvd7cbcx2c5kxkzoaw5e709bmxfdvsuj19vat4aaacaahf4zy09/ qoecsqcj6cfrv1pokybvjxgdicarrgbejlcuvdnofc9hmk9uk+ph2mdvrynvmsziay1n5tyrzzgkdaqvmh/as+cjvt91l2u4z4alepw+ Qz3zkje7ce1rwqwuitqxhcqthswz5czsk3g5ovpgy++k8y/khajavl7bha=
Finally, don't forget to change the permissions to 700
[Email protected] ~]# chmod 700/root/.ssh/
Okay, here we go, finally, you can re-login with SECURECRT and you'll find that you don't have to use your account and password again. However, it is a good idea to recreate the session. If found, cannot achieve, can consider, is not, iptables, or selinux problem, finally, also need to consider the network problem. Thank you.
Here's a look at the way Xshell.
1. Click the Tools in the Xshell menu bar and select the new User Key Generation Wizard to perform key pair build operations.
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/97/82/wKiom1kvYICgWbOtAAEYd1EGToo093.jpg-wh_500x0-wm_ 3-wmp_4-s_1224179580.jpg "title=" snap1.jpg "alt=" Wkiom1kvyicgwbotaaeyd1egtoo093.jpg-wh_50 "/>
Select Next to continue
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/97/82/wKiom1kvYLWjBiLxAAEhyzg_RmA892.jpg-wh_500x0-wm_ 3-wmp_4-s_41001704.jpg "title=" snap2.jpg "alt=" Wkiom1kvylwjbilxaaehyzg_rma892.jpg-wh_50 "/>
Generate a key pair, and then select Next
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/97/83/wKioL1kvYPfC8eYoAAFAe0n46nA854.jpg-wh_500x0-wm_ 3-wmp_4-s_2756109711.jpg "title=" snap3.jpg "alt=" Wkiol1kvypfc8eyoaafae0n46na854.jpg-wh_50 "/>
Here password, can fill, also can not fill, teacher suggested fill, I generally do not fill in. Then select Next:
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/97/82/wKiom1kvYTqQ_NIhAAEMqpzN1ws080.jpg-wh_500x0-wm_ 3-wmp_4-s_4029652278.jpg "title=" snap4.jpg "alt=" Wkiom1kvytqq_nihaaemqpzn1ws080.jpg-wh_50 "/>
Generate Public key
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/97/82/wKiom1kvYaLgIDJcAAFn_dW1Hsc477.jpg-wh_500x0-wm_ 3-wmp_4-s_3362939638.jpg "title=" snap5.jpg "alt=" Wkiom1kvyalgidjcaafn_dw1hsc477.jpg-wh_50 "/>
Then copy the contents of the public key to your server/root/.shh/authorized_keys.
Again this server configuration mode reference above.
Summarize:
1. If root is logged in,/root/.ssh/authorized_keys inside, place the public key content.
2. If it is a normal user, such as WANGTAOC, the content is/home/wangtaoc/.ssh/authorized_key
3. There is also the application of the springboard machine. This principle is also used. We'll summarize later.
4. There are also batch distributions, which also use this principle.
How to log in as a key pair for Linux