CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
How to do ssh connection from client-to-remote machine1-to-remote machine2-to-remote machine3 and execute command on remote machine3

 



sasikanth
New User

Aug 24, 2012, 4:30 AM

Post #1 of 2 (1257 views)
How to do ssh connection from client-to-remote machine1-to-remote machine2-to-remote machine3 and execute command on remote machine3 Can't Post

Hi All,

I am working on an automation scenario, where the steps mentioned below are to be performed;

1. Script has to run on client machine.

2. Using the Perl script on client machine, we need to login to remote machine-1 using ssh protocol.

3. From remote machine-1, the script should login to other remote machine-2 using ssh protocol.

4. From remote machine-2, the script should login to other remote machine-3 using ssh protocol and execute a command, collect the output.

Here limitations is we cannot directly contact remote machine-3 from client and our script should not create any copies of code on any of the remote machine used in the scenario.

I am a Perl beginner and explored Net::OpenSSH module, but came to know that, using this we can connect only to client -to- remote machine-1.

Any thoughts/example code to handle this scenario.


Thanking you,
Sasikanth


rovf
Veteran

Aug 30, 2012, 2:06 AM

Post #2 of 2 (1200 views)
Re: [sasikanth] How to do ssh connection from client-to-remote machine1-to-remote machine2-to-remote machine3 and execute command on remote machine3 [In reply to] Can't Post


Quote
and our script should not create any copies of code on any of the remote machine used in the scenario


Not even in /tmp?

And there is no host which you can see to from *all* your remote machines via, say NFS?

In this case, I would consider using Expect (either native expect scripting, or via http://search.cpan.org/~rgiersig/Expect-1.15/ or maybe http://search.cpan.org/CPAN/authors/id/B/BN/BNEGRAO/Net-SSH-Expect-1.09.tar.gz. I have no experience with the latter, so I can't say for sure whether it really will suit your needs, but maybe it does.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives