0

I've setup and created (manually) instance at google cloud, added my ssh key (from id_rsa.pub) into it, so I can ssh username@x.x.x.x without any password, user set as sudoer.

I've setup 'generic' provider in rubber.yml:

generic: key_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ssh/id_rsa.pub'].first}"

I've set in deploy.rb:

set :initial_ssh_user, 'username'

Now when i am trying to cap rubber:create_staging RAILS_ENV=staging, After few questions of role/ip its asking me for root password:

 ** 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

Over and over again

Paul Collingwood
  • 9,053
  • 3
  • 23
  • 36
alexey_the_cat
  • 1,812
  • 19
  • 33
  • I would suggest that you read the following article https://cloud.google.com/compute/docs/instances#root under "Root access and instance administrators" – George Nov 18 '14 at 00:50
  • thanks George, but i am trying to login with regular user ('username') and then only 'sudo su' it doesnt trying to ssh with 'root' – alexey_the_cat Nov 18 '14 at 09:03

0 Answers0