====== SSH Forward Agent ====== 將 Key 登錄 ssh-add [Key_File] 連線時加上 -A 參數 ssh -A user@host.com 或是在 ~/.ssh/config 檔案設定 Host [Host_Name] HostName [Domain_Name or IP] ForwardAgent yes 直接連線並使用設定好的參數 ssh [Host_Name] ====== 使用 SSH Key 登入 ====== 透過 Key Pair 登入,即可不需要輸入密碼。 ===== 簡易流程 ===== ==== 產生金鑰 ==== 產生 RSA 或 DSA 公私鑰 ssh-keygen -t rsa ssh-keygen -t dsa ==== 複製到目標主機 ==== scp ~/.ssh/*.pub 目標主機:~/.ssh/. ==== 設定目標主機 ==== 登入目標主機,將金鑰加入 ~/.ssh/authorized_keys 檔案內。 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys chmod 644 ~/.ssh/authorized_keys 登出並重新登入目標主機,測試是否不需密碼。 ===== Reference ===== * [[http://blog.longwin.com.tw/2005/12/ssh_keygen_no_passwd/|ssh keygen 免輸入密碼]] * [[http://josephj.com/article/understand-ssh-key/|SSH 免密碼登入]]