J
James Dinkel
This is really sort of an offshoot of this thread:
http://www.ruby-forum.com/topic/150015
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.
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
command:
-----------
require 'rubygems'
require 'net/ssh'
Net::SSH.start( 'server1',
:username=>'myuser',
assword=>'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
end
http://www.ruby-forum.com/topic/150015
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.
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
command:
-----------
require 'rubygems'
require 'net/ssh'
Net::SSH.start( 'server1',
:username=>'myuser',
assword=>'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
end