braintree / runbook

A framework for gradual system automation
MIT License
730 stars 43 forks source link

What username is used for ssh? #26

Closed pitosalas closed 4 years ago

pitosalas commented 4 years ago

Even though my runbook says user rails it seems that when the ssh is done it uses my own login name on the controlling computer. I am missing something simple.

#!/usr/bin/env ruby
require "runbook"

runbook = Runbook.book "My First" do
  description "Playing"

  section "SECTION" do
    server "165.227.126.51"
    user "root"
    step "$ ls" do
      note "doing an ls"
      command "ls -la"
    end
  end
end

if __FILE__ == $0
  Runbook::Runner.new(runbook).run
else
  runbook
end

/Users/pitosalas/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/net-ssh-5.2.0/lib/net/ssh.rb:263:instart': Authentication failed for user pitosalas@16.22.12.5 (Net::SSH::AuthenticationFailed)`

pitosalas commented 4 years ago

p.s. is there a user forum where I should ask this or do you want questions here?

pblesi commented 4 years ago

@pitosalas Asking questions here is fine. The user declaration determines what user you will sudo as once connected to the host. When connecting to the host, your current user will be used unless you specify user@ in the host string. More details here: https://github.com/braintree/runbook#remote-command-execution