1. 程式人生 > >ubuntu SSH 無密碼登入

ubuntu SSH 無密碼登入

#第一步:建立金鑰
使用金鑰登入需要先建立一對非對稱加密的金鑰, 使用ubuntu自帶的 ssh-keygen 金鑰生成工具即可生成
1.ssh-keygen -t rsa
一路回車
#第二步:用ssh-copy-id將公鑰複製到遠端機器中
2.ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
注意: ssh-copy-id 將key寫到遠端機器的 ~/ .ssh/authorized_key.檔案中
第三步: 登入到遠端機器不用輸入密碼
3.ssh [email protected]