一、环境介绍
二、生成一对密钥(在客户端中运行)
ssh-keygen
~/.ssh/中会生成两个文件 id_rsa.pub和id_rsa
id_rsa是密钥,id_rsa.pub是公钥,将id_rsa.pub放到server的~/.ssh/文件夹中
三、上传到服务器中(在客户端中运行)
scp id_rsa.pub root@192.168.0.153:~/.ssh
四、添加到authorized_keys(在服务器中运行)
cd ~/.ssh
cat id_rsa.pub >> authorized_keys