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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Perl script for SSH connection


New User

Jan 7, 2008, 5:09 PM

Post #1 of 2 (2378 views)
Perl script for SSH connection Can't Post


I am new to perl and trying to connect the remote Unix server through SSH port from my windows server. Is there any pre-written program to to achieve this. or pls. tell me other possibilities to achieve this

Pls. help me... Thanks in advance !!!

I used the following script but during compilation it throws the error weak references are not compiled.

use strict;
my $host="rc-hp39";
my $user="ca5555";
my $pass="passxx";

my $cmd="pwd";

use Net::SSH::Perl;

my $ssh=Net::SSH::Perl->new($host);


my ($stdout,$stderr,$exit)=$ssh->cmd($cmd);

print "Here is your present working directory : $stdout\n";

# you can run multiple commands just by invoking "my ($stdout,$stderr,$exit)=$ss
h->cmd($cmd); everytime or you might want to set up interactive shell";

# you will need to load the module Term::Readkey for that

# here is the additional code for that
# use Term::ReadKey;
# ReadMode('raw');
# $ssh->shell;
# ReadMode('restore');


Jan 7, 2008, 5:21 PM

Post #2 of 2 (2376 views)
Re: [guna] Perl script for SSH connection [In reply to] Can't Post

install the latest version of Scalar::Util and see if that helps. If you are using an older version of perl you may need to upgrade, 5.8.5 or higher should be good. But you would have to upgrade perl first, then install Scalar::Util if just installing Scalar::Util does not fix the error.


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

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