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 7025839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:02:00+00:00 2026-05-28T00:02:00+00:00

I currently have a Ruby (Rails) application that needs to make a lot of

  • 0

I currently have a Ruby (Rails) application that needs to make a lot of short SSH connections. This works fine using the Ruby Net::SSH library, except that the app has to log in and negotiate keys every time I want to make a command, which is too slow.

Is there a way to enable Control Master with Ruby Net::SSH? In testing on the command line, this makes logins (after the first one) very fast, since the connection is already open (keys are negotiated etc.).

If there is no way to do this with Net::SSH, can anybody suggest an alternative library that could do it?

I imagine this must be a common requirement, so hopefully someone can help.

Thanks!

  • 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-28T00:02:01+00:00Added an answer on May 28, 2026 at 12:02 am

    Why not just keeping the connection open ?
    The ssh calls are dummy as I don’t know the api but it serves its purpose:

    def ssh_execute(user, command)
      Thread.current[:user_connections] ||= {}
    
      unless Thread.current[:user_connections][user.id]
        Thread.current[:user_connections][user.id] = Net::SSH.connect(...)
      end
    
      ssh = Thread.current[:user_connections][user.id]
      ssh.run_command(command)
    end
    

    You will get one ssh connection per thread or if your application is deployed with passenger each process will have one connection and will reuse it.

    Is it what you want ?

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

Sidebar

Related Questions

Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I have a ruby-on-rails application that wishes to utilise the tumblr gem for adding
Our team have built a web application using Ruby on Rails. It currently doesn't
The Setup I have a Ruby on Rails application that I manage from a
I have an Ruby on Rails 3 Heroku application, which needs to perform text
Background I'm running a Ruby on Rails application that has to serve a lot
I currently have a Ruby on Rails system, and there are plans to port
I currently have an MS Access application that connects to a PostgreSQL database via
I'm using Ruby on Rails to develop a web application. I have a wiki
I have created a blog application using Ruby on Rails and have just added

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.