0

I would like to excute a shell script on a remote unix server. Now, I dont have direct connectivity to this server. I must go through jumphost which is also unix box. I want to make a batch file which execute the script on the remote server in one go. Below diagram may help to understand this better.

Local Machine-->Jumphost (Unix box)-->Remote unix server-->execute shell script

My batch job will connect to jumphost using telnet and then it should connect to remote server and execute the script.

How to do this in "one" go ??

2

You could use a ProxyCommand with SSH.

In your ssh config (~/.ssh/config):

Host remotehost.com
   ProxyCommand ssh user@jumphost.com -W %h:%p

Then execute the command:

ssh remotehost.com 'shellscript.sh'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.