Hi, I was trying to write a small script in ruby that will run specific commands and jobs on my remote server. it work fine but if I define "cmd" with "/bin/sh" to have terminal it doesn't work, any idea?
Code:
#!/usr/bin/ruby
require 'socket'
myhost = ARGV[0]
port = ARGV[1]
cmd = '/bin/sh'
soc = TCPSocket.new(myhost, port)
m = %x[#{cmd}]
soc.puts m
soc.close