隐形的翅膀歌曲张韶涵:SSH 免密碼登入 快速三步驟

来源:百度文库 编辑:九乡新闻网 时间:2024/04/28 18:37:43

SSH 免密碼登入 快速三步驟

被登入的主機當 Server,自己的當 Client

Step1 : 在 Client 端建立 Public 與 Private Key


$ssh-keygen -t dsa <==這個步驟產生 Keys
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa): <== 按下 Enter
Enter passphrase (empty for no passphrase): <== 按 Enter
Enter same passphrase again: <== 再按一次 Enter
Your identification has been saved in /root/.ssh/id_dsa. <== 私鑰
Your public key has been saved in /root/.ssh/id_dsa.pub. <== 公鑰
The key fingerprint is:
c4:ae:d9:02:d1:ba:06:5d:07:e6:92:e6:6a:c8:14:ba test@test.com


Step2 : 在 Server 端放置 Client 可以登入的公鑰


$cd ~/.ssh
$scp id_dsa.pub root@192.168.1.1:~/


Step3 : 登入到 Server 端,將公鑰轉存到 authorized_keys 檔案中


$ssh 192.168.1.1
$cat id_dsa.pub >> .ssh/authorized_keys


Ya!!! 大功告成! That‘s it!!! from:  http://blog.4ever.tw/blog/rayback/freebsd/2006/06/29/ssh_cc_eae