1、生产密钥对
按照阿里云的密钥生成说明执行即可,选择自动生成密钥。
参考链接:https://help.aliyun.com/document_detail/51793.html?spm=a2c4g.11186623.6.750.1484bf87nPe974
2、绑定密钥对
参考链接:https://help.aliyun.com/document_detail/51796.html?spm=a2c4g.11186623.6.752.76ae3a7bNtMWIT
3、SecureCRT使用密钥对登录
(1)创建链接,使用root用户,因为阿里云创建密钥并绑定服务器,阿里云只把公钥加到/root/.ssh/authorized_keys
(2)点击publickey——Propertier,在弹出框中,选择阿里云上下载下来的私钥,点击ok,如下图:
(3)准备就绪,点击connect连接服务器
4、配置普通用户使用密钥对登录
(1)上一步使用root用户登录成功后,把/root/.ssh/authorized_keys拷贝到普通用户家目录下,如用户为test:
cp -r /root/.ssh /home/test
(2)变更权限
chown -R test:group /home/test/.ssh
注意:test为用户,group为test用户所在用户组
(3)此时按照第3步,把root用户改为test用户,即可登录