[英]Losing Access to Server After Provisioning With Chef
I am using the rails-server-template available here ( https://github.com/TalkingQuickly/rails-server-template ) to provision a Rails server (Ubuntu 12.04) using Chef. 我正在使用此处( https://github.com/TalkingQuickly/rails-server-template )提供的rails-server-template来使用Chef来配置Rails服务器(Ubuntu 12.04)。 When I am setting up a new server, I copy my public ssh key
ssh-copy-id -i ~/.ssh/id_rsa.pub ubuntu@my-server.amazonaws.com
and am able to enter my server fine. 设置新服务器时,我复制了我的公共ssh密钥
ssh-copy-id -i ~/.ssh/id_rsa.pub ubuntu@my-server.amazonaws.com
,可以正常输入服务器。
But after I download a new copy of this template (updating the nodes/my-server.json file to this:) 但是在我下载了该模板的新副本之后(将nodes / my-server.json文件更新为:)
{
"environment": "production",
"authorization": {
"sudo": {
"users": ["deploy", "vagrant"]
}
},
"run_list": [
"role[server]",
"role[postgres-server]"
],
"automatic": {
"ipaddress": "my-server.amazonaws.com"
},
"postgresql": {
"password": {
"postgres": "password"
}
}
}
And also updating the deploy.json user in data_bags/users: 并更新data_bags / users中的deploy.json用户:
{
"id": "deploy",
// generate this with: openssl passwd -1 "plaintextpassword"
"password": "password",
"ssh_keys": [ "ssh-rsa my-public-key from ~/.ssh/id_rsa.pub"
],
"groups": [ "sysadmin"],
"shell": "\/bin\/bash"
}
For some weird reason, after provisioning the server with bundle exec knife solo bootstrap ubuntu@my-server.com, I get a Permission denied (publickey)
error. 出于某些奇怪的原因,在为服务器配置了捆绑exec刀单引导程序ubuntu@my-server.com之后,出现了“
Permission denied (publickey)
公共密钥Permission denied (publickey)
错误。 When trying to log-in using ssh, I get asked for the password for the ubuntu user, which I don't know. 尝试使用ssh登录时,系统会询问我不知道的ubuntu用户的密码。 I can't even log in with my key pair .pem file from Amazon EC2 anymore.
我什至无法再使用来自Amazon EC2的密钥对.pem文件登录。
Am I missing something? 我想念什么吗? I didn't change the server.json role, and I can't seem to figure out what is going on.
我没有更改server.json角色,而且似乎无法弄清楚发生了什么。 Has something changed my ssh configuration during provisioning?
设置期间是否更改了ssh配置?
Turns out when I was trying to ssh into my server, the user I was using was ubuntu
, whereas in the data_bags
, I set up a new user with the id deploy
. 原来,当我尝试ssh进入服务器时,我正在使用的用户是
ubuntu
,而在data_bags
,我使用id deploy
设置了一个新用户。 I needed to ssh in as the deploy
user. 我需要以
deploy
用户身份登录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.