EC2 AWS SSH访问权限被拒绝(公钥)
我正在尝试(使用chef solo和刀子solo)将一个应用程序部署到一个新创建的EC2实例上,正如我在使用Digital Ocean时所做的那样,没有任何问题EC2 AWS SSH访问权限被拒绝(公钥),ssh,amazon-ec2,Ssh,Amazon Ec2,我正在尝试(使用chef solo和刀子solo)将一个应用程序部署到一个新创建的EC2实例上,正如我在使用Digital Ocean时所做的那样,没有任何问题 ## once the EC2 instance is created and running ## from the console , I setup chef-solo $> knife solo prepare ubuntu@ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com
## once the EC2 instance is created and running
## from the console , I setup chef-solo
$> knife solo prepare ubuntu@ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com
## then I run the cookbook
$> knife solo cook ubuntu@ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com
## in this cookbook, I have a recipe to create a 'deploy' group and a user 'myself' in this group
## I also disable root login
## and I restrict login only to created user
## then other recipes without any problem ( postgres, rbenv, app..)
## as the user 'myself' is created , I should be able to run ( as w DigitalOcean)
$> ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 yves@ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com
But I get an error : Permission denied (publickey).
为什么不像DigitalOcean那样运行良好,AWS EC2有什么诀窍吗?用于启动实例的Ubuntu AMI与使用DigitalOcean的AMI不同
in /etc/ssh/sshd_config by default
PasswordAuthentication no
所以我需要在我的[ssh]配方中添加一个任务
# enable Password Authentication for new user
bash "allow Password Authentication to created user" do
code <<-EOH
sed -i '/PasswordAuthentication.*/d' /etc/ssh/sshd_config
echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
EOH
notifies :restart, "service[ssh]", :delayed
not_if "grep -xq 'PasswordAuthentication yes' /etc/ssh/sshd_config"
end
ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 deployer@ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com