close

Client端

1.

cd ~/.ssh

ssh-keygen

一路按OK, 會在~/.ssh目錄產生兩個檔案

id_rsa.pub:所謂的公鑰, 放到server被窺視也沒關係

id_rsa:所謂的私鑰,必須放到client使用者的目錄內

建議產生的這兩個檔案都改名一下,以免下次產生把原本的蓋掉

最好狀況就是公私鑰都放到目前的.ssh目錄

另外,id_rsa要改為400的權限,以免Server拒絕登入

 

2.

sudo vi ~/.ssh/config

Host ssh_name

</tab> User myname

</tab> InendityFile path_to_my_rsa_private_key

 

3.

把公鑰放到Server端的~/.ssh/authorized_keys這個檔案

這個步驟也許要admin才可以做

 

Server端

1.

vi /etc/ssh/sshd_config

把修改以下幾行的設定值
PasswordAuthentication no         不允許password

PubkeyAuthentication   yes        啟動RSA key認證

AuthorizedKeysFile %h//.ssh/authorized_keys       Server去找公鑰的路徑

 

重新啟動SSH server

這個每個版本可能都會有些差異,reboot是最保險的!

 

 

arrow
arrow
    文章標籤
    rsa ssh authorization
    全站熱搜

    Orion 發表在 痞客邦 留言(0) 人氣()