有人问在Mac的一个简单的方法来创build〜/ .ssh文件夹将通过运行命令ssh-keygen,然后使用以下设置…
一个。
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.然后创build:
touch ~/.ssh/authorized_keys
C.修复权限:
chmod 600 ~/.ssh/authorized_keys
D.将AWS Key复制到该文件:
cp AWS_key.text ~sam/.ssh/authorized_keys
#在创buildEC2实例时,您应该先保存此SSH密钥
E.然后testingssh到AWS Linux服务器 – 你会看到这个错误:
ssh -i ./authorized_keys root@ec2-54-76-176-29.ap-southeast-2.compute.amazonaws.com
请以用户“ec2-user”而不是用户“root”的身份login。
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.
希望这有所帮助,一切顺利。