After installing the gem through a simple
gem install net-ssh
the following script can be run in order to call the 'ls' application, used to list directory's contents:
require 'rubygems'
require 'net/ssh'
session = Net::SSH.start('your-host','your-user', 'your-password')
session.process.open("ls") do | ls |
ls.on_stdout do | p, data |
puts "#{data}"
end
end
No comments:
Post a Comment