This is really sort of an offshoot of this thread:
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
So I am just wonder if anybody has found ANY possible way to run remote
commands with root privileges on the remote computer.
here is my script as it is which seems to just skip over the sudo
:password=>‘mypass’ ) do |session|
session.open_channel do |channel| channel.on_data do |ch, data| puts data end channel.exec 'touch myfile' end session.loop session.open_channel do |channel| channel.on_data do |ch, data| puts data end channel.exec 'sudo touch rootfile' end session.loop
The “myfile” gets created, but the “rootfile” does not.