天天看點

Setup SSH Keys to Login Linux Without Password

生成公鑰和私鑰

ssh-keygen -b 4096 -t rsa 生成的私鑰儲存在 .ssh/id_rsa , 公鑰在.ssh/id_rsa.pub

上傳公鑰到遠端伺服器

編輯/etc/ssh/sshd_config檔案, 確定以下參數

RSAAuthentication yes PubkeyAuthentication yes

本地用戶端輸入

ssh-copy-id user@host 就可以将公鑰上傳到遠端伺服器的.ssh/authorized_keys 這個時候使用ssh user@host就可以不用輸入密碼直接登入遠端伺服器了。