清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
require 'rubygems' require 'net/ssh' Net::SSH.start('example.com', :username=>'yourName', :password=>'mypass') do |session| shell = session.shell.sync puts "#{shell.pwd.stdout}" shell.cd 'test_dir' puts "#{shell.pwd.stdout}" puts 'Directory contents:' puts shell.ls("-l").stdout shell.exit end