[root@sqzr ~]# ssh-keygen -b 1024 -t rsa
Generating public/private rsa key pair. #提示正在生成rsa密鑰對
Enter file in which to save the key (/root/.ssh/id_dsa): #詢問公鑰和私鑰存放的位置,回車用默認位置即可
Enter passphrase (empty for no passphrase): #詢問輸入私鑰密語,輸入密語
Enter same passphrase again: #再次提示輸入密語確認
Your identification has been saved in /root/.ssh/id_dsa. #提示公鑰和私鑰已經存放在/root/.ssh/目錄下
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
x6:68:xx:93:98:8x:87:95:7x:2x:4x:x9:81:xx:56:94 root@server #提示key的指紋
修改/etc/ssh/sshd_config 文件
將PasswordAuthentication yes 修改成 PasswordAuthentication no,並且重啟ssh
在putty導入私匙
再次登錄如果不用私匙連輸入密碼的幾乎都沒有,導入私匙後,登錄的時候只需要輸入私匙的口令就ok,就算私匙文件被別人拿到也沒事,別人無法知道是哪台服務器的,也無法得到私匙口令
工具下載地址:
puttygen官方下載鏈接:http://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe
putty官方下載鏈接:http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe