class SSHKit::Backend::Netssh

Public Instance Methods

put(strings, remote, options = {}) click to toggle source
# File lib/addon/sshkit_monkey_patch.rb, line 6
def put strings, remote, options = {}
    local = StringIO.new strings
    upload! local, remote, options
end
su_execute(user, cmd)
Alias for: su_run
su_run(user, cmd) click to toggle source
# File lib/addon/sshkit_monkey_patch.rb, line 11
def su_run user, cmd
  execute %Q(su - #{user} -c "#{cmd}")
end
Also aliased as: su_execute
sudo(cmd) click to toggle source
# File lib/addon/sshkit_monkey_patch.rb, line 16
def sudo cmd
    SSHKit::Backend::Netssh.config.pty = true
    # p host
    password = host.password
    execute %Q( echo #{password} | sudo -kS bash -c "#{cmd}" )

    # execute %Q(sudo bash -c "#{cmd}"), interaction_handler: {
    #     /\(yes\/no\)/i => "yes\n",
    #     /[sudo] password/i => "#{password}\n",
    # }

end