Nov 25, 2009

利用 rsa 登入 SSH Server

1. ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa): [按 Enter 使用預設值(建議)]
Enter passphrase: 輸入你的 Passphrase
Enter same passphrase again: 再一次輸入你的 Passphrase
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is: cc:e8:a9:da:a3:41:c6:a9:97:52:59:ef:0c:cf:45:b6 username@abc.com
2. scp ~/.ssh/*.pub 你欲登入的主機:~/.ssh/.
3. ssh 你欲登入的主機
4. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
5. chmod 711 ~/.ssh
6. chmod 644 ~/.ssh/authorized_keys

發現,用 ubuntu 9.10 完成以上這些動作,就可以直接登入主機,不需在使用 ssh-agent


Reference:
  1. ssh keygen 免輸入密碼
  2. SSH 免密碼登入
  3. PuTTY 免密碼登入
  4. OpenSSH Public Key Authentication

No comments: