Skip to content
Advertisement

pass commands server using perl openssh

there are 2 systems,

client system, in which i am passing commands to the server by doing openssh to the server and my script goes like this

JavaScript

and in server /p/inway/bin/inway71 is a scripts:

JavaScript

so when i login to my server and run this script in my terminal, i will be directed to some path (i have no clue what it is, but i guess its one more server which i can login using this bash script) and i can do the rest of the activity like cd,ls,cat, etc etc)

but when i run this from my client system it passes the control to the terminal and waits for my input, and in my terminal i get an error saying,

JavaScript

In my terminal i can do ls or anything, but not able to do it from the perl script and capture the result. How can i resolve this and get what i want?

Advertisement

Answer

That remote command expects to be run in interactive mode. This doesn’t work with the SSH command mode. See this Net::OpenSSH FAQ!

You can:

  1. find a way to pass commands as arguments to that script.
  2. rewrite it to accept commands as arguments.
  3. talk to it using Expect.
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement