AWS 更换 SSH 登陆密钥对
SSH AWS About 1,407 words生成公钥
根据pem
生成
ssh-keygen -f test.pem -y
输出
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCg790nrFFilxxxxxmfNDEV6r4UtpBNYzHLwFYu/JKqtuvxxxxxLjGCBOfacZ7Zwyoc/JYIaDMZRFzBi8xxxxxGgIPmMGP8HugCX/X7YDTbSNa0xxxxxPsvg48jLavGtKPIqOEiChRuncqe7b/UVyz7JDK28txxxxxQr7Zb4kzNQzDTLtobUEhNSS4qAUgR6gRm/6gxxxxxo/VJt9kSD7np1+9GzVuhHWx7bgYM9RwosBJs0TsTRRykRgEd2lj3vF3f4c63yxJxxxxxvgmDZPubCUU5wTHGDMxJ8c+/tT0gvxoXpOdlqccgxxxxxt08npHQin8VXw2TEV87emFJVXWR
编辑配置
vim ~/.ssh/authorized_keys
根据输出的公钥添加到authorized_keys
文件中,注意尾部添加空格和pem
名称。
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCg790nrFFilxxxxxmfNDEV6r4UtpBNYzHLwFYu/JKqtuvxxxxxLjGCBOfacZ7Zwyoc/JYIaDMZRFzBi8xxxxxGgIPmMGP8HugCX/X7YDTbSNa0xxxxxPsvg48jLavGtKPIqOEiChRuncqe7b/UVyz7JDK28txxxxxQr7Zb4kzNQzDTLtobUEhNSS4qAUgR6gRm/6gxxxxxo/VJt9kSD7np1+9GzVuhHWx7bgYM9RwosBJs0TsTRRykRgEd2lj3vF3f4c63yxJxxxxxvgmDZPubCUU5wTHGDMxJ8c+/tT0gvxoXpOdlqccgxxxxxt08npHQin8VXw2TEV87emFJVXWR test.pem
错误信息
[root@hello ~]$ ssh-keygen -f test.pem -y
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'test.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "test.pem": bad permissions
解决方法
chmod 600 test.pem
参考文档
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html
Views: 3,300 · Posted: 2021-07-13
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...