vim/etc/ssh/sshd_config, the following three lines remove the comment symbol #rsaauthentication yespubkeyauthentication yesauthorizedkeysfile. ssh/authorized_keysmkdir -P ~/. SSH chmod ~/. SSH
Generate public and private keys
[Email protected].SSH]# CD ~/.SSH[email protected].SSH]#Ssh-keygen-T rsagenerating Public/private RSA key pair. Enterfile inch whichTo save the key (/root/.SSH/id_rsa): Enter Passphrase (empty forno passphrase): Enter same passphrase Again:your identification has been savedinch/root/.SSH/Id_rsa. Your public key has been savedinch/root/.SSH/id_rsa.pub.The Key fingerprint is: the: +: -:Bayi:DF: 8e:6e:0f:ce:ee:a7:fd:f9:6e: the: -[email protected]the key's Randomart image is:+--[RSA2048]----+| .. || . . || ... || .... E | | O oo. S. || +. .. . . || .. . . || Ooo. ... || +*+o.o=o |+-----------------+[email protected].SSH]#
Configuration
[Email protected].SSH]#CatId_rsa.pub >Authorized_keys[[email protected].SSH]#chmod -Authorized_keys[[email protected].SSH]# lltotal A-RW-------.1Root root408Jul One at: GenevaAuthorized_keys-RW-------.1Root root1675Jul One A: -Id_rsa-rw-r--r--.1Root root408Jul One A: -Id_rsa.pub
Download Id_rsa to local, convert to. ppk file with Pyttygen, configure to Putty, configure login username root
Login As:rootserver refused our key[email protected] 192.168. 88.133 ' s Password:
Login failed ... Requires disable SELinux
[Email protected] ~0~~]#
Try to succeed again!
" Root " "imported-openssh-key"login: :192.168. 88.1 ~]#
Perpetual Disable SELinux
/etc/selinux/config, modify selinux=disabled or permissive
CentOS Configuration putty RSA Automatic Login