remote-session
Run user, and sudo, commands over an SSH connection
Installation
Add this line to your application's Gemfile:
gem 'remote/session'
And then execute:
$ bundle
Or install it yourself as:
$ gem install remote-session
Usage
require 'remote/session'
r = Remote::Session.new( 'host.example.com' )
puts r.run( 'pwd' )
puts r.sudo( 'apt-get update' )
r.close
In a block:
Remote::Session.new( 'host.example.com', :user => 'user' ) | r | do
puts r.run( 'pwd' )
puts r.sudo( 'apt-get update' )
end
Options:
Remote::Session.new( 'host.example.com', :user => 'user', :password => 'password' ) | r | do
puts r.run( 'pwd' )
puts r.sudo( 'apt-get update' )
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request