0

I have a Perl script running on a Windows machine. I need this script to open a ssh session to a remote Unix machine, and to be able to execute certain commands on that Unix machine and to be able to get the output returned from these commands.

These commands are generated during the run-time of the script, and there are many of them executed at different times.

How can I do it?

2 Answers 2

2

Approach 1: Use CYGWIN: http://perlwin32ssh.blogspot.com/2007/07/test_4418.html

Approach 2: Use Net::SSH::W32Perl module.

This is one thread discussing how to install it: http://code.activestate.com/lists/perl-win32-users/29180/ (It seems to require downloading custom version of the module)

This thread should help with the problems arising from dependencies on math libraries needed for ssh calculations: http://www.issociate.de/board/post/494356/I%27m_trying_to_install_%27Net::SSH::Perl%27_on_a_Windows_Box..html

Caveat emptor: I never installed this, the above is just result of some analysis of google results.

Sign up to request clarification or add additional context in comments.

Comments

0
#!/usr/bin/perl

system("ssh foo 'ls -l'");

Or go through the hassle of using ptmx(4) on the local side and ssh -t for remote.

2 Comments

which won't work on Windwos (as required in questions) as it doesnt have an SSH command.
Well, that would require an ssh client on your windows machine. Do you have one?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.