Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3698892
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:02:12+00:00 2026-05-19T05:02:12+00:00

This is pretty weird. I have my public key added at host machine. I

  • 0

This is pretty weird. I have my public key added at host machine. I can simply run

ssh -p <port> -l <username> hostt.com

which simply opens the remote shell. I can even run my capistrano scripts for the deployments on the same machine. But when i was trying connect with this following simple ruby script

require 'rubygems'
require 'net/ssh'

Net::SSH.start("hostt.com", 
               :port => <port>, 
               :username => <username>
              ) do |session|
  puts session.pwd
end

it refuses immediately with the following exception:

`initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)

Is there anything I’m missing here?

Appreciate your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:02:13+00:00Added an answer on May 19, 2026 at 5:02 am

    Okay, now after a few days when I look back to the problem, I got a quick success with the following tweak:

    Net::SSH.start("<host>", "<user>", :port => "<port>") { |ssh|
      puts "logged in"
      puts ssh.exec!("ls -l")  
    } rescue puts "failed to connect."
    

    So the difference with the previous one is the username, which in this case is passed as the second argument rather than like an option key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is pretty weird. I have my Profiler open and it obviously shows that
I have a pretty weird problem related to zend framework's zend_db. I use $this
I'm having some weird issues with Xcode, and this is pretty much impossible to
I have written something like this pretty easily in C# ( string GetUrl(new {
I have this weird problem where my Google Maps API script doesn't work, no
Something pretty weird is happening with my app: I have the following property in
I have a pretty weird problem in my iPhone app which is, I think,
Okay, this is pretty weird. I made an app that listens for changes inside
I know this is a weird on, but in my code, i have development
I found this pretty weird thing when I first installed SQL Server 2008, for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.