I use ssh password-less connection to connect to a Windows server from a Linux server. The connection is made to the E:\FTP working directory. I did a dir to list the file in the working directory. I had no output. I need to change directory to E:\pilot\dev_te st directory.
I tried to use chdir(). It did not work. Followings are the code. Can anyone please help?
The outputs are as below:
stderr=
stdout=
exit = 8772
stderr=
stdout=
exit = 8772
I tried to use chdir(). It did not work. Followings are the code. Can anyone please help?
Code:
#!/usr/local/bin/perl
use Net::SSH::Perl;
use Net::SCP::Expect;
my $remote_host = "remote_Windows_server.com";
my $user = "aacesrdev";
my $ssh = Net::SSH::Perl->new($remote_host, debug => 1, identity_files =>["/home/aacesrdev/.ssh/id_rsa"], protocol=>'2,1');
$ssh->login($user);
my $cmd = "dir";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print "stderr= $stderr\n";
print "stdout= $stdout\n";
print "exit = $exit\n";
my($stdout, $stderr, $exit) = $ssh->cmd(chdir("E:\pilot\dev_test"));
print "stderr= $stderr\n";
print "stdout= $stdout\n";
print "exit = $exit\n";
stderr=
stdout=
exit = 8772
stderr=
stdout=
exit = 8772
Comment