一、準備ssh-copy-id 服務器
brew install ssh-copy-id ssh
二、生成私鑰公鑰 spa
ssh-keygen -t rsa -b 1024 it
三、將公鑰上傳致服務器(~/.ssh/authorized_keys) io
ssh-copy-id -i 公鑰 root@192.168.1.xxx email
四、在本地~/.config文件中添加(若是沒有則新建) rsa
Host xxx
HostName 192.168.1.xxx
User root
PreferredAuthentications publickey
IdentityFile ~/.ssh/私鑰 im
ssh-keygen -t dsa –C user.email –f ~/.ssh/user.email ssh-key