How to run command in another/remote host?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • littlemaster
    New Member
    • Apr 2010
    • 25

    How to run command in another/remote host?

    I need to run a command in remote host, I tried the following but I got error. Kindly solve this,

    #!/usr/bin/env ruby
    require 'rubygems'
    require 'net/ssh'

    HOST = '192.168.1.113'
    USER = 'username'
    PASS = 'password'

    Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|
    ssh.exec('ls')
    end

    Error:
    /usr/lib/ruby/1.8/net/ssh/session.rb:132: in `initialize': rmts (Net::SSH::Auth enticationFaile d)
    from /usr/lib/ruby/1.8/net/ssh.rb:47:in `new'
    from /usr/lib/ruby/1.8/net/ssh.rb:47:in `start'
    from run_command.rb: 9
  • kleach
    New Member
    • Jun 2010
    • 15

    #2
    Can you ssh between the servers without Ruby?

    Comment

    • littlemaster
      New Member
      • Apr 2010
      • 25

      #3
      ssh problem in ruby

      yes. I can login with ssh by entering password.

      Comment

      Working...