From: Arlen Cuss Date: 2008-04-19T13:18:36+09:00 Subject: Re: Ruby script to run command as root on remote linux system ------=_Part_6454_30979728.1208578716348 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, On Sat, Apr 19, 2008 at 2:48 AM, James Dinkel wrote: > I WAS just trying to pass on the password to sudo being run over > Net::SSH on a remote linux server. I eventually gave up on that and set > sudo to run with no password, only to find out that does not work > either! For some reason there is a problem running sudo commands over > Net::SSH. > Strange. It works for me: >> Net::SSH.start 'localhost', :username => 'test', :password => '...' do |session| ?> session.open_channel do |channel| ?> channel.on_data do |ch, data| ?> puts data >> end >> channel.exec 'sudo touch rootfile' >> end >> session.loop >> end; nil => nil >> celtic@sohma:~$ ls -l ~test total 0 -rw-r--r-- 1 test test 0 2008-04-19 14:16 a lrwxrwxrwx 1 test test 26 2008-04-19 14:14 Examples -> /usr/share/example-content/ -rw-r--r-- 1 root root 0 2008-04-19 14:17 rootfile celtic@sohma:~$ Are you sure the user can always sudo without password? Arlen ------=_Part_6454_30979728.1208578716348--