阿里云 - 密钥对

阿里云密钥对管理
新建密钥对后绑定实例
将.pem文件放在 ~/.ssh文件中
将.pem文件权限设置为只读
chmod 400 ~/.ssh/new-ecs.pem

创建~/.ssh/config文件

1
2
3
4
5
Host aliyun-ecs
HostName xxx.xx.xxx.xx
User root
IdentityFile ~/.ssh/new-ecs.pem
Port 22

后续通过 ssh aliyun-ecs 登陆

远程拷贝文件

1
2
3
4
5
# 拉取远程nginx.conf文件
scp -i ~/.ssh/new-ecs.pem root@xxx.xx.xxx.xx:/etc/nginx/nginx.conf .

# 将本文件夹下所有文件拷贝到远程ssl目录
scp -i ~/.ssh/new-ecs.pem -r ./* root@xxx.xx.xxx.xx:/etc/nginx/ssl/

阿里云 - 密钥对
http://example.com/2025/11/28/阿里云-密钥对/
作者
dsaco
发布于
2025年11月28日
许可协议