From: "Tuấn N." Date: 2013-06-16T00:44:39+09:00 Subject: Re: Can't run sudo under ssh.exec! channel.exec(" sudo ls -l") do |ch, success| abort "Could not execute commands!" unless success channel.on_data do |ch, data| channel.send_data "#{pass}\n" if data =~ /password/ puts "#{data}" end ... ... My problem is: after I executed successfully first command (ls -l), how can I catch data, do something with it, and then execute another command WITHOUT enter sudo password again. Thanks all. -- Posted via http://www.ruby-forum.com/.