2011年2月8日 星期二

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

1 則留言:

  1. 想請問笨問題 如果其他服務 可以用同一個鑰匙??還是要另外創見一個呢?? 好混亂XD 謝謝

    回覆刪除

How to repair and clone disk with ddrescue

  ddrescue  is a tool that can be used to repair and clone disks on a  Linux system . This includes hard drives, partitions, DVD discs, flas...