CentOS系統中,在登錄SSH的時候需要密碼登錄,其實只要進行簡單的設置,就是實現SSH無密碼登錄,想要知道如何設置嗎?隨小編一起來學習下CentOS實現SSH無密碼登錄的方法吧。
一、環境配置
1、服務端:CentOS release 5.3 IP:222.73.115.198
2、客服端:CentOS release 5.8 IP:192.168.4.244
二、配置SSH無密碼登錄需要3步:
1、生成公鑰和私鑰
2、導入公鑰到認證文件,更改權限
3、測試
三、客戶端配置
1、在客戶端生成私鑰與公鑰;
# ssh-keygen
[root@jw02 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): #回車(代表無需密碼登陸)
Enter passphrase (empty for no passphrase): #回車
Enter same passphrase again: #回車
Your identification has been saved in /root/.ssh/id_rsa. #代表私鑰
Your public key has been saved in /root/.ssh/id_rsa.pub. #代表公鑰
The key fingerprint is:
04:45:0b:47:10:92:0c:b2:b9:d7:11:5b:49:05:e4:d9 root@jw02
[root@jw02 ~]# ls ~/.ssh/
id_rsa id_rsa.pub known_hosts
2、默認在 ~/.ssh或者/root/.ssh/目錄生成兩個文件:
公鑰為:id_rsa.pub
私鑰為:id_rsa
上一頁12下一頁共2頁