在客戶端生成一對密鑰(公鑰/私鑰)
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
參數說明:
-t 加密算法類型,這裏是使用rsa算法
-P 指定私鑰的密碼,不需要可以不指定
-f 指定生成祕鑰對保持的位置
將客戶端公鑰發送個服務端(其他客戶端),使用ssh-copy-id
bash: ssh-copy-id: 未找到命令... 或者
bash: ssh-copy-id :command not found
curl -L https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/install.sh | sh
測試:
1.輸入本地安裝軟件的密碼, 看到 Installed ssh-copy-id into /usr/local/bin. 的輸出信息就表示安裝成功了
2.ssh 用戶名@IP地址