1

What im trying to do:

  • service-hosted rails app ( heroku or something )

  • user logs into application and wants to " DO THINGS "

  • " DO THINGS " entails running commands to the local machine i have here in my apartment

I've SSHed into a server before ... but i think this would be best setup if the server initiates the connection

  1. I'm FAIRLY running a permanent SSH isnt the best idea
  2. I'm not 100% sure on the process .. i just need information transfer between my hosted application .. and my local machine.

ruby socket set of commands which could possibly work?

any particular gem that would handle this?

Thanks ahead of time!

3
  • You mean like raw TCP messages? Commented Jan 22, 2011 at 21:16
  • im thinking SSH connections .. which i've done before .. but they've all been client side initiated .. im thinking: 1) permanent SSHed arent good .. and thus im going to need a SERVER-side initiated SSH to the local machine Commented Jan 22, 2011 at 23:08
  • 1
    I suggest,you could setup a simple and secure web serivice application (to run in your local machine) that listen for command from server and exec it. Commented Jan 23, 2011 at 1:56

1 Answer 1

2

so far it looks like NetSSH is the answer im looking for

at command prompt:

$ gem install net-ssh

Next we create a new controller file:

app/controllers/ssh_connections_controller.rb

and inside ssh_connections_controller.rb file place:

  def conn

  Net::SSH.start( '127.0.0.1','wonton' ) do |session|
    session.open_channel do |channel|
      channel.on_close do |ch|
        puts "channel closed successfully."
        render :text => 'hits'
      end
      puts "closing channel..."
      channel.close
    end

    session.loop
  end

  end

... and substitute your local settings... 'wonton' would be the name of whatever user you want to SSH in as

more to be updated!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.