473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Connecting to Cygwin uisng perl and unable changing directory

Hi all,

I have Cygwin installed and running on Windows machine. I can connect to and send certain commands like "ls","pwd". But when I try to change the directory I am gettign an exception. Here is my code:

use strict;
use warnings;
use Net::OpenSSH;

my $host = 'host';
my $username = 'user';
my $password = 'pass';
my $cmd1 = 'cd/';
my $cmd2 = 'ls';

my $ssh = Net::OpenSSH->new($host,
user => $username,
password => $password,
timeout => 30,
strict_mode => 0,
master_opts => [ -o => "StrictHostKeyChecking=no"]);

$ssh->error and
die "ssh failed: " . $ssh->error;

$ssh->system($cmd1) or
die "remote command failed: " . $ssh->error;
my ($out,$err) = $ssh->capture($cmd1);
$ssh->error and
die "remote command failed: " . $ssh->error;

$ssh->system($cmd2) or
die "remote command failed: " . $ssh->error;
($out, $err) = $ssh->capture2($cmd2);
$ssh->error and
die "remote command failed: " . $ssh->error;


thanks
--girija
Aug 6 '14 #1
0 882

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: christian_stengel | last post by:
Hi *, I have just started to learn python and I am having a problem with an python client connecting to a perl server using ssl (I tried this with pyOpenSSL and with the build in SSL Module). ...
1
by: Graham | last post by:
Which is better perl setup on w98se: Full cygwin or activestate ? (or other) In particular I will probably be installing DBI +DBD and using with Oracle 9i Personal Regards Graham
2
by: James Hull | last post by:
Hi All: I am new in the Perl world. So far I have installed cygwin and Perl 5.8.0 along with Perl DBI and DBD::Oracle modules. NowI am trying to install Perl Tk on my PC (Windows 2K). I have...
9
by: gopi | last post by:
when installing db2, it only asks for installation directory and does not ask where it is going to store data files. how can i change the default directory after installation.
9
by: débutante | last post by:
bonjour tout le monde je veux installer perl soous cygwin. pour y procéder voici nles étapes ke g fait: 1) g téléchargé activeperl et je l'ai installé => résultat: c/perl le perl toune...
1
by: nehaz | last post by:
i wanted to open a file using perl and the output of print cmd to be added in that file. can i do it using perl ? what if i use following the following ".pl " file. open CONFIG, ">HELLO.txt";...
1
by: nehaz | last post by:
can anyone tell me how can i configure a device from HTTP page using perl ? I am using following cmd to enter the http page use HTTP::Request; $req = HTTP::Request->new($httpRequestMethod =>...
3
by: Max58kl | last post by:
Trying to access data and print it to the screen using Perl Builders I/O Window -------------------------------------------------------------------------------- Hi I am using a program called...
4
by: phoenie | last post by:
Hi everyone, I am a newbie in Perl. I would like to know how to extract the abbreviation from a given text using Perl. For example, Dr. Alex is a very smart doctor. He is from USA. Then my...
5
by: pavanponnapalli | last post by:
hi, I have got a list of files in a "list" as follows: foreach(@arr) { copy ("$_", "/home/pavan/tmp") or die "copy failed: $! "; } The path where the files...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.