Anyway the specific code that I added to a ruby on rails application is the following:
#!/usr/bin/env ruby
require 'rubygems'
require 'net/ssh'
HOST = '192.168.1.75'
USER = 'user'
PASS = 'its'
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|
output = ssh.exec!('ls')
puts output
end
The code uses the Net::SSH gem, which I explained previously and there is an entry about it on the wiki.
This is not exactly the code itself, because I had to adapt it to the ruby on rails application, which works pretty weird and the only thing I could do to print the output data from the remote ls instruction, was to use some kind of html function that ruby on rails added to the code.
I updated the wiki with this and other examples I found using Net::SSH.
Nominaciones:
Alex and Victor
Bien; 5 y 5.
ResponderEliminar