permission denied for Net::SSH::Perl module

--0-1236294001-1297364977=:27728
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi All,

i am using Perl :net:ssh module to connect remotely to server and execute t=
he remote command
following is the code :

my %opt =3D ( 'options' =3D> [ 'ForwardAgent yes','RSAuAuthentication yes',=
'ConnectTimeout 120','ServerAliveInterval 60','ServerAliveCountMax 20','deb=
ug 1','identity_files /home/irfanjs/.ssh/id_rsa','UserKnownHostsFile /home/=
irfanjs/.ssh/known_hosts' ] );
$opt{'identity_files'} =3D [ $identity ];
my $ssh =3D Net::SSH::Perl->new($host, %opt);
print "creating an ssh object\n";
print "loggin in \n";
$ssh->login($user);

my $cmd =3D "ls";
print "gonna run $user\ [at] $host $cmd\n";
=A0($stdout, $stderr, $exit) =3D $ssh->cmd("$cmd");
print "$stderr\n";
print "$stdout\n";

but when i run the script, it fails saying that , "permission denied " erro=
r
manually i am able to run the "ls" command using the identity file but when=
i run the same using Perl then it fails

can someone please suggest

regards
Irfan

=0A=0A=0A
--0-1236294001-1297364977=:27728--
Irfan Sayed [ Do, 10 Februar 2011 20:09 ] [ ID #2054956 ]

cleaning regular expression output

Is there a way to match and substitute at the same time?

I have an html table where each row contains 11 columns of numbers.

Unfortunately all the numbers have commas separating the thousands, millions=
, etc.

To find the number I need to match against [\d,].

What I really want is the capture array or $1, $2, $3, etc. to be free of co=
mmas, all done in the matching step.

Any ideas?=

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
David Jacopille [ Do, 10 Februar 2011 22:07 ] [ ID #2054958 ]

Re: cleaning regular expression output

On 2/10/11 Thu Feb 10, 2011 1:07 PM, "David Jacopille"
<perl [at] shortloop.com> scribbled:

> Is there a way to match and substitute at the same time?
>
> I have an html table where each row contains 11 columns of numbers.
>
> Unfortunately all the numbers have commas separating the thousands, millions,
> etc.
>
> To find the number I need to match against [\d,].
>
> What I really want is the capture array or $1, $2, $3, etc. to be free of
> commas, all done in the matching step.
>
> Any ideas?

Yes. Capture the numbers with the commas included ([\d,]+), then delete the
commas with tr/,//d;





--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Jim Gibson [ Do, 10 Februar 2011 23:04 ] [ ID #2054959 ]

Re: permission denied for Net::SSH::Perl module

--0-246756642-1297942938=:11697
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi All,

I am still facing the issue. can someone please suggest ??

~irfan

--- On Thu, 2/10/11, Irfan Sayed <irfan_sayed2002 [at] yahoo.com> wrote:

From: Irfan Sayed <irfan_sayed2002 [at] yahoo.com>
Subject: permission denied for Net::SSH::Perl module
To: beginners [at] perl.org
Date: Thursday, February 10, 2011, 11:09 AM

Hi All,

i am using Perl :net:ssh module to connect remotely to server and execute t=
he remote command
following is the code :

my %opt =3D ( 'options' =3D> [ 'ForwardAgent yes','RSAuAuthentication yes',=
'ConnectTimeout 120','ServerAliveInterval 60','ServerAliveCountMax 20','deb=
ug 1','identity_files /home/irfanjs/.ssh/id_rsa','UserKnownHostsFile /home/=
irfanjs/.ssh/known_hosts' ] );
$opt{'identity_files'} =3D [ $identity ];
my $ssh =3D Net::SSH::Perl->new($host, %opt);
print "creating an ssh object\n";
print "loggin in \n";
$ssh->login($user);

my $cmd =3D "ls";
print "gonna run $user\ [at] $host $cmd\n";
=A0($stdout, $stderr, $exit) =3D $ssh->cmd("$cmd");
print "$stderr\n";
print "$stdout\n";

but when i run the script, it fails saying that , "permission denied " erro=
r
manually i am able to run the "ls"=0A command using the identity file but w=
hen i run the same using Perl then it fails

can someone please suggest

regards
Irfan


=0A=0A =0A=0A=0A
--0-246756642-1297942938=:11697--
Irfan Sayed [ Do, 17 Februar 2011 12:42 ] [ ID #2055415 ]

Re: permission denied for Net::SSH::Perl module

Hi Irfan,

In the first line...

'RSAuAuthentication yes'

That looks like a typo to me.

On 2/17/2011 3:42 AM, Irfan Sayed wrote:
> Hi All,
>
> I am still facing the issue. can someone please suggest ??
>
> ~irfan
>
> --- On Thu, 2/10/11, Irfan Sayed<irfan_sayed2002 [at] yahoo.com> wrote:
>
> From: Irfan Sayed<irfan_sayed2002 [at] yahoo.com>
> Subject: permission denied for Net::SSH::Perl module
> To: beginners [at] perl.org
> Date: Thursday, February 10, 2011, 11:09 AM
>
> Hi All,
>
> i am using Perl :net:ssh module to connect remotely to server and execute the remote command
> following is the code :
>
> my %opt = ( 'options' => [ 'ForwardAgent yes','RSAuAuthentication yes','ConnectTimeout 120','ServerAliveInterval 60','ServerAliveCountMax 20','debug 1','identity_files /home/irfanjs/.ssh/id_rsa','UserKnownHostsFile /home/irfanjs/.ssh/known_hosts' ] );
> $opt{'identity_files'} = [ $identity ];
> my $ssh = Net::SSH::Perl->new($host, %opt);
> print "creating an ssh object\n";
> print "loggin in \n";
> $ssh->login($user);
>
> my $cmd = "ls";
> print "gonna run $user\ [at] $host $cmd\n";
> ($stdout, $stderr, $exit) = $ssh->cmd("$cmd");
> print "$stderr\n";
> print "$stdout\n";
>
> but when i run the script, it fails saying that , "permission denied " error
> manually i am able to run the "ls"
> command using the identity file but when i run the same using Perl then it fails
>
> can someone please suggest
>
> regards
> Irfan
>
>
>
>
>
>
>
>


--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Nathan Barham [ Do, 17 Februar 2011 15:33 ] [ ID #2055416 ]

Re: permission denied for Net::SSH::Perl module

On 17/02/2011 11:42, Irfan Sayed wrote:
> Hi All,
>
> I am still facing the issue. can someone please suggest ??
>
> ~irfan
>
> --- On Thu, 2/10/11, Irfan Sayed<irfan_sayed2002 [at] yahoo.com> wrote:
>
> From: Irfan Sayed<irfan_sayed2002 [at] yahoo.com>
> Subject: permission denied for Net::SSH::Perl module
> To: beginners [at] perl.org
> Date: Thursday, February 10, 2011, 11:09 AM
>
> Hi All,
>
> i am using Perl :net:ssh module to connect remotely to server and execute the remote command
> following is the code :
>
> my %opt = ( 'options' => [ 'ForwardAgent yes','RSAuAuthentication yes','ConnectTimeout 120','ServerAliveInterval 60','ServerAliveCountMax 20','debug 1','identity_files /home/irfanjs/.ssh/id_rsa','UserKnownHostsFile /home/irfanjs/.ssh/known_hosts' ] );
> $opt{'identity_files'} = [ $identity ];
> my $ssh = Net::SSH::Perl->new($host, %opt);
> print "creating an ssh object\n";
> print "loggin in \n";
> $ssh->login($user);
>
> my $cmd = "ls";
> print "gonna run $user\ [at] $host $cmd\n";
> ($stdout, $stderr, $exit) = $ssh->cmd("$cmd");
> print "$stderr\n";
> print "$stdout\n";
>
> but when i run the script, it fails saying that , "permission denied " error
> manually i am able to run the "ls"
> command using the identity file but when i run the same using Perl then it fails
>
> can someone please suggest

It is impossible to tell what the problem might be from a code fragment
such as this. I am not encouraged to trust your competence, as you claim
you are 'using Perl :net:ssh module'. Since not even Perl::SSH::Net
appears on CPAN I guess that you are using Net::SSH::Perl.

Since you don't 'use' the module, and because none of $exit, $host,
$identity, $stderr, $user are declared, I guess you have removed part of
your code, in the expectation that we can guess what that part contains
and assume it to be correct.

As a start I would try declaring $host and $identity, and making sure that:

my $ssh = Net::SSH::Perl->new($host, debug => 1, identity_files => [ $identity ] );

and see what sort of result you get from that. Then try adding the
out-of-band options on at a time to see if they change anything.

Rob




--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Rob Dixon [ Do, 17 Februar 2011 16:07 ] [ ID #2055418 ]

Re: cleaning regular expression output

--20cf3054a4f93af077049c9af7e2
Content-Type: text/plain; charset=ISO-8859-1

As a disclaimer, I'm in the middle of reading Mastering Regular
Expressions[0], so my head isn't in the right place. None of these solutions
should be used in production code ever, probably.

Assuming something like 1,000,000,000,123,212,888,546,248 is in $_,

Using only a match, no substitution:
say join '', /(?:\b(\d+)\K)?,(\d{3})/g;

Using the /r switch, so this should only work for fairly modern Perls
s/(\d+(?:,\d{3})*)/ $1 =~ tr!,!!rd /e;
say;

Without capturing groups,
/\d+(?:,\d{3})*/;
substr($_, $-[0], $+[0] - $-[0]) =~ tr/,//d;
say;

And here's what I would actually be using:
s/ (?<=\d) , (?=\d{3}) //xg;
say;

Brian.

[0] http://regex.info/

--20cf3054a4f93af077049c9af7e2--
Brian Fraser [ Sa, 19 Februar 2011 05:21 ] [ ID #2055518 ]
Perl » gmane.comp.lang.perl.beginners » permission denied for Net::SSH::Perl module

Vorheriges Thema: Access single element of AOH
Nächstes Thema: Calling a PHP function from a Perl script.