我已经在谷歌云上设置并创建了(手动)实例,将我的 ssh 密钥(来自 id_rsa.pub)添加到其中,所以我可以 ssh username@x.x.x.x
在没有任何密码的情况下将用户设置为 sudoer。
我在 Rubber.yml 中设置了“通用”提供程序:
通用:key_file:“#{Dir[(File.expand_path('~') rescue '/root') + '/.ssh/id_rsa.pub'].first}”
我已经在 deploy.rb 中设置:
设置:initial_ssh_user,'用户名'
现在,当我尝试时cap rubber:create_staging RAILS_ENV=staging
,在角色/ip 的几个问题之后,它要求我输入 root 密码:
** Instance api-staging created: api-staging
Waiting for instances to start
** Instance running, fetching hostname/ip data
.Trying to enable root login
Password for username @ x.x.x.x: .
* 2014-11-16 14:07:45 executing `rubber:_ensure_key_file_present'
* 2014-11-16 14:07:45 executing `rubber:_allow_root_ssh'
* executing "sudo -p 'sudo password: ' bash -l -c 'mkdir -p /root/.ssh && cp /home/username/.ssh/authorized_keys /root/.ssh/'"
servers: ["x.x.x.x"]
** Can't connect as user cat.of.duty to x.x.x.x, assuming root allowed
* 2014-11-16 14:07:46 executing `rubber:_direct_connection_x.x.x.x'
* executing "echo"
servers: ["x.x.x.x"]
.. ** Failed to connect to x.x.x.x, retrying
一遍又一遍地