From: Eric Hodel Date: 2008-04-18T06:48:54+09:00 Subject: Re: Windows, Net::SSH: how do I send a password to sudo? On Apr 17, 2008, at 13:56 PM, James Dinkel wrote: > James Dinkel wrote: >>>>> channel.exec "echo #{password} | sudo -S echo \"r00ted\"". >> >> This isn't working. It seems to be having a problem with the >> pipe. I >> think I'll have to figure out how to send stdin into a channel (I >> seem >> to remember seeing something about this in the net-ssh docs). > > for the life of me I still can not get this to work. The pipe > actually > seems to work fine for other commands I tried (just to see) but not > with > sudo. What's the deal?! Don't send a password to sudo via a pipe. Change the sudoers file instead to allow your user to sudo without a password.