1. 在mac 上生成秘钥对 无需密码直接回车
ssh-keygen -t rsa
2. 将秘钥拷贝到 阿里云并重命名,这里是因为阿里云也有自己的秘钥
cp ~/.ssh/id_rsa.pub ruiven@xxx.xxx.xxx.xxx:/data/download
3.在阿里云ECS新建authorized_keys
touch ~/.ssh/authorized_keys
4.将从mac 拷贝来的秘钥存储到authorized_keys文件
cat /data/download/id_rsa.pub >> ~/.ssh/authorized_keys
5. 修改目录权限
chmod 644 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
测试ssh
Ruiven@m ~/ > ssh txyun
Last login: Wed Mar 30 14:03:36 2022 from xxx.xxx.xxx.xxx
[ruiven@VM-1-13-centos ~]#
done!