On Feb 7, 5:42 pm, Rha <rh... / hotmail.com> wrote: > Just tested this mini-script on Windows, and it works. > > require 'net/ssh' > > Net::SSH.start('yourhost.com', :port => 22, :username => 'youruser', > :password => 'yourpassword') do |session| > shell = session.shell.sync > puts "connected" > puts "ls" > shell.send_command "echo 'yourpassword' | sudo -S ls" > puts 'Exiting' > shell.exit > puts "Exited" > end > > Hope this works for you, btw, I couldn't make it work by sending the > text as parameter to send_command :(, at least you can make it work > some way. > > Gabriel Medina. > The admins somehow set me up so the only sudo command I can do is: sudo su acctname When I do that command, sudo reads raw characters or something because you can not see anything on the screen at all. What I ended up doing is creating a named pipe on the remote machine, then I run this perl script (while logged in using sudo) that just reads from the pipe and executes any commands I send it. So I use net::ssh to copy the files to my remote home dir, then I write: "cp file destfile" to the pipe and the perl script moves them into the directory that the sudo privillges are needed to acces. #!/usr/local/bin/perl while (1) { open(PIP, 'mypipe'); while (<PIP>) { chomp; print "$_\n"; system($_); } close(PIP); }