I’m establishing an ssh connection and then I want to run a command as
sudo. Now, normally, the user will be prompted to put in a password to
run the command as sudo.
Here is my script:
Net::SSH.start( ‘files02’, ‘myuser’, ‘mypassword’ ) do |session|
session.open_channel do |channel|
channel.on_data do |ch, data|
channel.exec "sudo echo \"hello\""
But this doesn’t prompt for a password ( not surprisingly ) and of
course doesn’t run the command. Any ideas on how I could get the
password prompt to the user?