有人在 Mac 上询问创建 ~/.ssh 文件夹的简单方法是运行命令 ssh-keygen,然后使用以下设置...
A.
macbook-air$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/sam/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/sam/.ssh/id_rsa.
Your public key has been saved in /Users/sam/.ssh/id_rsa.pub.
B.然后创建:
touch ~/.ssh/authorized_keys
C.修复权限:
chmod 600 ~/.ssh/authorized_keys
D.将 AWS 密钥复制到该文件:
cp AWS_key.text ~sam/.ssh/authorized_keys
#你会在创建 EC2 实例时提前保存这个 SSH 密钥
E.然后测试 ssh 到 AWS Linux 服务器 - 你会看到这个错误:
ssh -i ./authorized_keys root@ec2-54-76-176-29.ap-southeast-2.compute.amazonaws.com
请以用户“ec2-user”而不是用户“root”登录。
F。重试,它应该可以与允许的 AWS 用户“ec2-user”一起使用:
ssh -i ./authorized_keys ec2-user@ec2-54-76-176-29.ap-southeast-2.compute.amazonaws.com
__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-ami/2014.09-release-notes/
9 package(s) needed for security, out of 12 available
Run "sudo yum update" to apply all updates.
希望这会有所帮助,一切顺利。