a:进入根目录:cd ~
ssh-keygen -t rsa -C "youname" 例如:ssh-keygen -t rsa -C "xxxx"
输入上面ssh-keygen开头的命令后,需要输入密码的地方按enter
b:查看秘钥
cat ~/.ssh/id_rsa.pub
ssh-copy-id -i ~/.ssh/id_rsa.pub 测试机IP
例如: ssh-copy-id -i ~/.ssh/id_rsa.pub 127.0.0.1
如果要输入密码输入自己登入linux的密码。