List server files with SSH : ssh « Network « Ruby






List server files with SSH


require 'rubygems'
require 'net/ssh'


Net::SSH.start('example.com', :username=>'userName',
               :password=>'mypass') do |session|
  cmd = 'ls -l /home'
  session.process.popen3(cmd) do |stdin, stdout, stderr|
    puts stdout.read
  end
end

 








Related examples in the same category

1.An SSH Client
2.Change directory with SSH
3.Copying a File to Another Machine