ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 11)
Brought to you by:
dbrobins
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(4) |
Feb
(15) |
Mar
(13) |
Apr
(8) |
May
(5) |
Jun
(21) |
Jul
(4) |
Aug
(9) |
Sep
(11) |
Oct
(14) |
Nov
(15) |
Dec
(24) |
2005 |
Jan
(10) |
Feb
(20) |
Mar
(16) |
Apr
(10) |
May
(12) |
Jun
(16) |
Jul
(18) |
Aug
(21) |
Sep
(11) |
Oct
(19) |
Nov
(16) |
Dec
(9) |
2006 |
Jan
(17) |
Feb
(32) |
Mar
(60) |
Apr
(21) |
May
(24) |
Jun
(1) |
Jul
(6) |
Aug
(18) |
Sep
(4) |
Oct
(9) |
Nov
(31) |
Dec
(10) |
2007 |
Jan
(8) |
Feb
(11) |
Mar
(3) |
Apr
(7) |
May
(4) |
Jun
(6) |
Jul
(7) |
Aug
(3) |
Sep
(2) |
Oct
(5) |
Nov
(5) |
Dec
(5) |
2008 |
Jan
(12) |
Feb
(5) |
Mar
(7) |
Apr
(4) |
May
(37) |
Jun
(9) |
Jul
(24) |
Aug
(5) |
Sep
(2) |
Oct
(7) |
Nov
(6) |
Dec
(7) |
2009 |
Jan
(18) |
Feb
(9) |
Mar
(14) |
Apr
(14) |
May
(1) |
Jun
(14) |
Jul
(4) |
Aug
(6) |
Sep
(4) |
Oct
(12) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(3) |
Mar
|
Apr
(1) |
May
(4) |
Jun
|
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(7) |
Nov
(2) |
Dec
(5) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(8) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
|
Oct
(4) |
Nov
(9) |
Dec
(7) |
2012 |
Jan
(1) |
Feb
(19) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
(6) |
Dec
|
2014 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Heiko J. <ja...@hb...> - 2008-07-14 07:04:23
|
Am Sonntag, den 13.07.2008, 23:32 -0700 schrieb Vikas Poonia: > Thanks a lot for your help. The code for Scp keys is now working. > Actually the problem was i was not able to use keys at my server. When > i copied the public key to the server it si working fine now. TKs a > lot again. Did you even try to open a ssh session from your client to the server? This is the most basic test and I really expected that you checked that first. > Now I want to implement SFTP by using the package Net::SSH2. Do u have > any idea how we can do this I havent used it earlier. The standard procedure would be to a) read the docs, b) check out the tests in the Net::SSH2 package (~/t/Net-SSH2.t) for sample code and c) try for yourself.... Heiko > Thanks and Regrads > Vikas Poonia > > Heiko Jansen <ja...@hb...> wrote: > > Am Mittwoch, den 09.07.2008, 21:58 -0700 schrieb Vikas Poonia: > [...] > > if ( $ssh2->auth_publickey( $user, > > '/opt/mqm/home/kls_dev/.ssh/id_rsa.pub', > > '/opt/mqm/home/kls_dev/.ssh/id_rsa' ) ) > > { > > warn "Authentication succeeded\n" if $ssh2->auth_ok(); > > } > > else { > > die "Authentication failed! $!"; > > } > > $ssh2->scp_get('/pkg/COBL/COBLxx72/users/kls_dev/vikas'); > > exit 0; > > > > > > bash-3.00$ ./vik-te.pl > > Authentication failed! Invalid argument at ./vik-te.pl line > 35. > > Net::SSH2::DESTROY object 0x22a6d0 > > > > I dont khw why it is giving invalid argument. i have passed > argument > > as in the example. Can you please let me know some other > way? > > a) Are you sure you really have the key files mentioned above? > In your > previous post you wrote: > -- snip -- > Where Public key= '/opt/mqm/home/kls_dev/vikas/id.pub' > and Private key = '/opt/mqm/home/kls_dev/vikas/id' > -- / snip -- > Make sure the files you provide to the method really exist in > the > directory and with the name you mention. And of course it > should be the > same key pair from which you took the public key that you > configured on > the remote host. > > Also, please put in a line > -- snip -- > warn "libbsh2 Status:\n" . join( "\n", $ssh2->error() ); > -- / snip -- > before the line > -- snip -- > die "Authentication failed! $!"; > -- / snip -- > It provides the libssh2 error codes and messages. > > Heiko |
From: PUSHPARAJ B.S <pus...@ho...> - 2008-07-13 10:42:32
|
Hi close STDOUT; close STDERR; $ssh=Net::SSH::Perl->new("113.128.160.214"); $ssh->login($UNM,$Pass); $cmd="ping 114.9.36.142"; $ssh->register_handler(SSH_SMSG_STDOUT_DATA,sub{($ssh,$packetout)=@_;push(@output,$packetout->get_str);$cache->set($session,[0,@output])}); ($stdout,$stderr,$exit)=$ssh->cmd($cmd); The above code connects to the machine using SSH and executes a ping command which asynchronously throws the output through the handler . The output is pushed into the array variable "@output" and this is printed from the session using cache. But I get to see only the first 2 lines of the output . What is wrong ? Moreover I would also like to print Standard error messages in the same output. How can I acheive this using the handler . Thanks Alfaromeo _________________________________________________________________ Searching for the best deals on travel? Visit MSN Travel. http://msn.coxandkings.co.in/cnk/cnk.do |
From: PUSHPARAJ B.S <pus...@ho...> - 2008-07-12 10:39:04
|
Hiclose STDOUT; close STDERR; $ssh=Net::SSH::Perl->new("113.128.160.214"); $ssh->login($UNM,$Pass); $cmd="ping 114.9.36.142"; $ssh->register_handler(SSH_SMSG_STDOUT_DATA,sub{($ssh,$packetout)=@_;push(@output,$packetout->get_str);$cache->set($session,[0,@output])}); ($stdout,$stderr,$exit)=$ssh->cmd($cmd); The above code connects to the machine using SSH and executes a ping command which asynchronously throws the output through the handler . The output is pushed into the array variable "@output" and this is printed . But I get to see only the first 2 lines of the output . What is wrong ? Moreover I would also like to print Standard error messages in the same output. How can I acheive this using the handler . Thanks Alfaromeo _________________________________________________________________ Searching for the best deals on travel? Visit MSN Travel. http://msn.coxandkings.co.in/cnk/cnk.do |
From: PUSHPARAJ B.S <pus...@ho...> - 2008-07-12 10:39:03
|
Hiclose STDOUT; close STDERR; $ssh=Net::SSH::Perl->new("113.128.160.214"); $ssh->login($UNM,$Pass); $cmd="ping 114.9.36.142"; $ssh->register_handler(SSH_SMSG_STDOUT_DATA,sub{($ssh,$packetout)=@_;push(@output,$packetout->get_str);$cache->set($session,[0,@output])}); ($stdout,$stderr,$exit)=$ssh->cmd($cmd); The above code connects to the machine using SSH and executes a ping command which asynchronously throws the output through the handler . The output is pushed into the array variable "@output" and this is printed . But I get to see only the first 2 lines of the output . What is wrong ? Moreover I would also like to print Standard error messages in the same output. How can I acheive this using the handler . Thanks Alfaromeo _________________________________________________________________ Wish to Marry Now? Join Shaadi.com FREE! http://www.shaadi.com/registration/user/index.php?ptnr=mhottag |
From: Heiko J. <ja...@hb...> - 2008-07-10 06:57:03
|
Am Mittwoch, den 09.07.2008, 21:58 -0700 schrieb Vikas Poonia: [...] > if ( $ssh2->auth_publickey( $user, > '/opt/mqm/home/kls_dev/.ssh/id_rsa.pub', > '/opt/mqm/home/kls_dev/.ssh/id_rsa' ) ) > { > warn "Authentication succeeded\n" if $ssh2->auth_ok(); > } > else { > die "Authentication failed! $!"; > } > $ssh2->scp_get('/pkg/COBL/COBLxx72/users/kls_dev/vikas'); > exit 0; > > > bash-3.00$ ./vik-te.pl > Authentication failed! Invalid argument at ./vik-te.pl line 35. > Net::SSH2::DESTROY object 0x22a6d0 > > I dont khw why it is giving invalid argument. i have passed argument > as in the example. Can you please let me know some other way? a) Are you sure you really have the key files mentioned above? In your previous post you wrote: -- snip -- Where Public key= '/opt/mqm/home/kls_dev/vikas/id.pub' and Private key = '/opt/mqm/home/kls_dev/vikas/id' -- / snip -- Make sure the files you provide to the method really exist in the directory and with the name you mention. And of course it should be the same key pair from which you took the public key that you configured on the remote host. Also, please put in a line -- snip -- warn "libbsh2 Status:\n" . join( "\n", $ssh2->error() ); -- / snip -- before the line -- snip -- die "Authentication failed! $!"; -- / snip -- It provides the libssh2 error codes and messages. Heiko |
From: Heiko J. <ja...@hb...> - 2008-07-09 13:16:03
|
Am Mittwoch, den 09.07.2008, 04:18 -0700 schrieb Vikas Poonia: > First thanks a lot. Here i am sending the code which i m executing and > the error which i am getting. > > #!/usr/bin/env perl -w > use Net::SSH2; > use Net::SCP; > use warnings; > use strict; > my $z_host="10.153.178.170"; > my $z_user="kls_dev"; > my $z_auth="xxx"; > my $ssh2 = Net::SSH2->new(); > $ssh2->debug(1); > $ssh2->connect($z_host) or die "Unable to connect Host $@ \n Der Host > $@ ist nicht erreichbar! \n"; > $ssh2->auth_publickey("kls_dev",'/opt/mqm/home/kls_dev/vikas/id.pub','/opt/mqm/home/kls_dev/vikas/id' ) or die "Not able to Login"; > #########$ssh2->scp_put("vikas", "mist-scp-key") or die "Unable to > transfer file $@ \n"; > > Where Public key= '/opt/mqm/home/kls_dev/vikas/id.pub' > and Private key = '/opt/mqm/home/kls_dev/vikas/id' > > When i run this program on my perl i m getting ther error > > bash-3.00$ ./vikas-scppwd > Not able to Login at ./vikas-scppwd line 15. > Net::SSH2::DESTROY object 0x20b118 > > Can u please let me know what needs to be done. Thanks in Advance Please try this code after replacing the appropriate values (user, host, keyfile names, testfile): -- snip -- #!/usr/bin/perl use strict; use warnings; use Net::SSH2; my $host = 'platon'; my $user = 'jansen'; my $keypath = '/home/jansen/.ssh/'; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); eval { $ssh2->connect($host) }; if ($@) { die "Unable to connect host '$host': $@"; } my $auth = $ssh2->auth_list($user); # works if connection succeeded if ( index( $auth, 'publickey' ) == -1 ) { die "Remote host '$host' does not support 'publickey' authentication!\n"; } if ( $ssh2->auth_publickey( $user, $keypath . 'id_rsa.pub', $keypath . 'id_rsa' ) ) { warn "Authentication succeeded\n" if $ssh2->auth_ok(); } else { die "Authentication failed!"; } $ssh2->scp_get('/home/jansen/_SCP_'); exit 0; -- / snip -- |
From: Rajnikant <raj...@pe...> - 2008-07-08 05:26:07
|
For authentication I used following work around. use Net::SFTP; my %args = ( "user", $usr, "password", $passwd, ); my $sftp = Net::SFTP->new($host_l,%args); Regards, Rajnikant. -----Original Message----- From: ssh...@li... [mailto:ssh...@li...] On Behalf Of ssh...@li... Sent: Monday, July 07, 2008 7:01 PM To: ssh...@li... Subject: Ssh-sftp-perl-users Digest, Vol 22, Issue 2 Send Ssh-sftp-perl-users mailing list submissions to ssh...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users or, via email, send a message with subject or body 'help' to ssh...@li... You can reach the person managing the list at ssh...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Ssh-sftp-perl-users digest..." Today's Topics: 1. Re: help needed for SFTP,SCP keys (Heiko Jansen) 2. Re: help needed for SFTP,SCP keys (Heiko Jansen) 3. About sftp->ls method (Rajnikant) 4. Re: About sftp->ls method (Heiko Jansen) 5. Unable to install Perl Module with cpan Repository on Linux (moh...@wi...) ---------------------------------------------------------------------- Message: 1 Date: Mon, 07 Jul 2008 09:37:35 +0200 From: Heiko Jansen <ja...@hb...> Subject: Re: [Ssh-sftp-perl-users] help needed for SFTP,SCP keys To: "ssh...@li..." <ssh...@li...> Message-ID: <121...@tr...> Content-Type: text/plain Am Montag, den 07.07.2008, 00:22 -0700 schrieb Vikas Poonia: > > I have one problem in Perl. I need to implement SFTP-Password, > SFTP-Keys,SCP-Password and Scp-Keys in Perl to transfer the file from > one system to another system. I have already implemented ftp and it is > working fine [...] > But for SFTP, SCP etc I am not able to find the function equivalent to > these like new,login,put etc. > does anyone have any sample code or 2-3 lines which explain all these. > I will be hoghly thankful to all of you. I am using > > use Net::SSH2; > > If have any idea about this please let me know. Thanks in Advance Just connect to the remote host with Net::SSH2 (using password or key) and then use the methods scp_get/scp_put of the Net::SSH2 object or retrieve an Net::SSH2::SFTP object by using the method call "sftp" on the Net::SSH2 object. It's all in the Net::SSH2 (or Net::SSH2::SFTP) documentation. The SYNOPSIS paragraph in Net::SSH2 POD even has a (shortened) example for SFTP transfer. Heiko ------------------------------ Message: 2 Date: Mon, 07 Jul 2008 13:06:53 +0200 From: "Heiko Jansen" <ja...@hb...> Subject: Re: [Ssh-sftp-perl-users] help needed for SFTP,SCP keys To: <ssh...@li...> Message-ID: <487...@ag...> Content-Type: text/plain; charset=US-ASCII Am Montag, den 07.07.2008, 02:01 -0700 schrieb Vikas Poonia: [...] > i am getting problem only when i try to connect. I am getting the > error 'unable to connect the remote host' for Scp-Keys my code looks > like > 1) my $ssh2 = Net::SSH2->new(); I really hope that there's a step 1a) $ssh2->connect($z_host) or die "Connecting $z_host failed"; > 2) $ssh2->auth_publickey("$z_user", "$publickey" , "$privatekey" ) or > die "Unable to login to user $z_user host $z_host $@ \n Login user > $z_user auf Host $@ nicht moeglich! \n"; Looks like some variables got mixed up. That error message should probably read -- snip -- die "Unable to login user $z_user on host $z_host: $@ \n Login user $z_user auf Host $z_host nicht moeglich! \n"; -- / snip -- But of course that can't be the source of the connection problems. > 3) $ssh2->scp_put(("$f_flam", "$f_ftp") or die "\nKonnte SST-Datei > $f_flam nicht nach $f_ftp versenden!\n\n"; > where $z_user is name of remote host I believe you meant "$z_host" here... > i m getting error on line nos 2 itself. > can u please suggest me something. do i need to change something in > place of $z_user etc. For any helpful advice you should provide more info on which error messages you get. Please turn on debug messages with "$ssh->debug(1);". You could also restart the ssh daemon on the server with a higher log level and have a look at the logfiles there if you believe that the problem source might be found there. Heiko ------------------------------ Message: 3 Date: Mon, 7 Jul 2008 17:29:22 +0530 From: "Rajnikant" <raj...@pe...> Subject: [Ssh-sftp-perl-users] About sftp->ls method To: <ssh...@li...> Message-ID: <006901c8e028$e5a81250$30c...@pe...> Content-Type: text/plain; charset="us-ascii" Hello everyone, I'm using sftp->ls method to see files on remote location. Following files are present on remote location: 5.txt, 4.txt, 3.txt, 2.txt, 1.txt Is there possibility that I'll get sftp->ls out put as 5.txt 4.txt -- -- 1.txt Can I have sorted sftp->ls out put? Out put I want is: 1.txt -- -- 4.txt 5.txt Thanks in advance. DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 4 Date: Mon, 07 Jul 2008 14:20:58 +0200 From: Heiko Jansen <ja...@hb...> Subject: Re: [Ssh-sftp-perl-users] About sftp->ls method To: "ssh...@li..." <ssh...@li...> Message-ID: <121...@tr...> Content-Type: text/plain Am Montag, den 07.07.2008, 17:29 +0530 schrieb Rajnikant: > > I'm using sftp->ls method to see files on remote location. Following > files are present on remote location: > 5.txt, 4.txt, 3.txt, 2.txt, 1.txt > > Is there possibility that I'll get sftp->ls out put as 5.txt 4.txt > -- > -- > 1.txt > > Can I have sorted sftp->ls out put? Out put I want is: > 1.txt > -- > -- > 4.txt > 5.txt As far as I know, $sftp->ls() (where $sftp IS_A Net::SFTP object) returns a list of hash references and there are no options of pre-sorting that list. But no one stops you from iterating over the list, extracting the names and sorting them in any way you like. So the answer to your questions is "yes" - but the way to get there is possibly not as convenient as you'd hoped ;-) Heiko PS: Another option would be to use do_opendir($path) and then use a readdir-loop directly on the dir handle, fetching all filenames and sorting them afterwards. PPS: Yet another method: Use Net::SSH2, execute a shell command ("ls" with the necessary switches) and capture and parse the output. ------------------------------ Message: 5 Date: Mon, 7 Jul 2008 19:00:42 +0530 From: <moh...@wi...> Subject: [Ssh-sftp-perl-users] Unable to install Perl Module with cpan Repository on Linux To: <ssh...@li...> Message-ID: <7A0...@BL...> Content-Type: text/plain; charset="us-ascii" Hi All, I want to install SSH module through cpan repository on linux, I am getting the following error. But I can install the modules manually by downloading the modules from cpan.org and using manual method. cpan> install Net::FTP Warning: Cannot install Net::FTP, don't know what it is. Try the command i /Net::FTP/ to find objects with matching identifiers. Please help me to overcome this. Thanks, Mustafa ________________________________ From: Mohammed Mustafa (WT01 - Testing Services) Sent: Wednesday, May 28, 2008 8:32 PM To: 'ssh...@li...' Subject: How to execute a perl script at remote server Hi All, I have written a Perl script, which deals with the ftp ing (transferring) the file to remote server and executing a Perl script (AUT) at remote m/c. The script is as below and here I have 2 doubts, so please help me to resolve this. 1) I am getting the message like "could not transfer the file to server" but it is ftp ing the flie to remote m/c, and I can see that file ( root1.txt ) there. 2) And I want to run the perl script (AUT) at remote m/c depending on the data we sent, so could you please let me know how can I achieve this. Is it possible for me to do system("test.pl"), If I am at SFTP mode. Please see comment line in the code below. #!/usr/bin/perl -w use strict; use warnings; use Net::SFTP; my $server="A.BY.C.D"; my $user="roserag"; my $password="june@123"; my %args = (user => "$user", password => "$password", ssh_args => []); $args{debug} = 1; $args{user} = "root"; my $file="local.txt"; my $rfile = "root1.txt"; my $sftp=Net::SFTP->new($server, %args) or die "could not open connection to $server\n"; $sftp->put($file,$rfile) or die " could not transfer the file to server \n"; # system("test.pl"); Is this command work out. exit; [gaurav@testbrix Examples]$ perl sftp3.pl testbrix.wipro.com: Reading configuration data /home/gaurav/.ssh/config testbrix.wipro.com: Reading configuration data /etc/ssh_config ................................... ................................... testbrix.wipro.com: sftp: In write loop, got 510 offset 0 testbrix.wipro.com: sftp: Sent message T:10 I:2 testbrix.wipro.com: sftp: Sent message T:4 I:3 could not transfer the file to server But I can see the file 1,1 All Regards, Mustafa -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ------------------------------ _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users End of Ssh-sftp-perl-users Digest, Vol 22, Issue 2 ************************************************** DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. |
From: Russ B. <us...@gm...> - 2008-07-07 15:33:59
|
I use this: @$files_in_directory = $sftp->ls($remote_server_directory); foreach (@$files_in_directory) { $longlist = $_->{longname}; $shortname = $_->{filename}; print "longname = $longname}\n"; print "shortname = $shortname\n"; if ($shortname =~ /txt/) { push @arrivals, $shortname; } } Then sort @arrivals any way you want. Hope this helps. Russ On Mon, Jul 7, 2008 at 8:20 AM, Heiko Jansen <ja...@hb...> wrote: > > Am Montag, den 07.07.2008, 17:29 +0530 schrieb Rajnikant: > > > > > I'm using sftp->ls method to see files on remote location. Following > > files are present on remote location: > > 5.txt, 4.txt, 3.txt, 2.txt, 1.txt > > > > Is there possibility that I'll get sftp->ls out put as > > 5.txt > > 4.txt > > -- > > -- > > 1.txt > > > > Can I have sorted sftp->ls out put? Out put I want is: > > 1.txt > > -- > > -- > > 4.txt > > 5.txt > > As far as I know, $sftp->ls() (where $sftp IS_A Net::SFTP object) > returns a list of hash references and there are no options of > pre-sorting that list. > But no one stops you from iterating over the list, extracting the names > and sorting them in any way you like. > So the answer to your questions is "yes" - but the way to get there is > possibly not as convenient as you'd hoped ;-) > > Heiko > > PS: Another option would be to use do_opendir($path) and then use a > readdir-loop directly on the dir handle, fetching all filenames and > sorting them afterwards. > > PPS: Yet another method: Use Net::SSH2, execute a shell command ("ls" > with the necessary switches) and capture and parse the output. > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > |
From: <moh...@wi...> - 2008-07-07 13:31:20
|
Hi All, I want to install SSH module through cpan repository on linux, I am getting the following error. But I can install the modules manually by downloading the modules from cpan.org and using manual method. cpan> install Net::FTP Warning: Cannot install Net::FTP, don't know what it is. Try the command i /Net::FTP/ to find objects with matching identifiers. Please help me to overcome this. Thanks, Mustafa ________________________________ From: Mohammed Mustafa (WT01 - Testing Services) Sent: Wednesday, May 28, 2008 8:32 PM To: 'ssh...@li...' Subject: How to execute a perl script at remote server Hi All, I have written a Perl script, which deals with the ftp ing (transferring) the file to remote server and executing a Perl script (AUT) at remote m/c. The script is as below and here I have 2 doubts, so please help me to resolve this. 1) I am getting the message like "could not transfer the file to server" but it is ftp ing the flie to remote m/c, and I can see that file ( root1.txt ) there. 2) And I want to run the perl script (AUT) at remote m/c depending on the data we sent, so could you please let me know how can I achieve this. Is it possible for me to do system("test.pl"), If I am at SFTP mode. Please see comment line in the code below. #!/usr/bin/perl -w use strict; use warnings; use Net::SFTP; my $server="A.BY.C.D"; my $user="roserag"; my $password="june@123"; my %args = (user => "$user", password => "$password", ssh_args => []); $args{debug} = 1; $args{user} = "root"; my $file="local.txt"; my $rfile = "root1.txt"; my $sftp=Net::SFTP->new($server, %args) or die "could not open connection to $server\n"; $sftp->put($file,$rfile) or die " could not transfer the file to server \n"; # system("test.pl"); Is this command work out. exit; [gaurav@testbrix Examples]$ perl sftp3.pl testbrix.wipro.com: Reading configuration data /home/gaurav/.ssh/config testbrix.wipro.com: Reading configuration data /etc/ssh_config ................................... ................................... testbrix.wipro.com: sftp: In write loop, got 510 offset 0 testbrix.wipro.com: sftp: Sent message T:10 I:2 testbrix.wipro.com: sftp: Sent message T:4 I:3 could not transfer the file to server But I can see the file 1,1 All Regards, Mustafa |
From: Heiko J. <ja...@hb...> - 2008-07-07 12:19:58
|
Am Montag, den 07.07.2008, 17:29 +0530 schrieb Rajnikant: > > I'm using sftp->ls method to see files on remote location. Following > files are present on remote location: > 5.txt, 4.txt, 3.txt, 2.txt, 1.txt > > Is there possibility that I'll get sftp->ls out put as > 5.txt > 4.txt > -- > -- > 1.txt > > Can I have sorted sftp->ls out put? Out put I want is: > 1.txt > -- > -- > 4.txt > 5.txt As far as I know, $sftp->ls() (where $sftp IS_A Net::SFTP object) returns a list of hash references and there are no options of pre-sorting that list. But no one stops you from iterating over the list, extracting the names and sorting them in any way you like. So the answer to your questions is "yes" - but the way to get there is possibly not as convenient as you'd hoped ;-) Heiko PS: Another option would be to use do_opendir($path) and then use a readdir-loop directly on the dir handle, fetching all filenames and sorting them afterwards. PPS: Yet another method: Use Net::SSH2, execute a shell command ("ls" with the necessary switches) and capture and parse the output. |
From: Rajnikant <raj...@pe...> - 2008-07-07 11:58:53
|
Hello everyone, I'm using sftp->ls method to see files on remote location. Following files are present on remote location: 5.txt, 4.txt, 3.txt, 2.txt, 1.txt Is there possibility that I'll get sftp->ls out put as 5.txt 4.txt -- -- 1.txt Can I have sorted sftp->ls out put? Out put I want is: 1.txt -- -- 4.txt 5.txt Thanks in advance. DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. |
From: Heiko J. <ja...@hb...> - 2008-07-07 11:07:34
|
Am Montag, den 07.07.2008, 02:01 -0700 schrieb Vikas Poonia: [...] > i am getting problem only when i try to connect. I am getting the > error 'unable to connect the remote host' for Scp-Keys my code looks > like > 1) my $ssh2 = Net::SSH2->new(); I really hope that there's a step 1a) $ssh2->connect($z_host) or die "Connecting $z_host failed"; > 2) $ssh2->auth_publickey("$z_user", "$publickey" , "$privatekey" ) or > die "Unable to login to user $z_user host $z_host $@ \n Login user > $z_user auf Host $@ nicht moeglich! \n"; Looks like some variables got mixed up. That error message should probably read -- snip -- die "Unable to login user $z_user on host $z_host: $@ \n Login user $z_user auf Host $z_host nicht moeglich! \n"; -- / snip -- But of course that can't be the source of the connection problems. > 3) $ssh2->scp_put(("$f_flam", "$f_ftp") or die "\nKonnte SST-Datei > $f_flam nicht nach $f_ftp versenden!\n\n"; > where $z_user is name of remote host I believe you meant "$z_host" here... > i m getting error on line nos 2 itself. > can u please suggest me something. do i need to change something in > place of $z_user etc. For any helpful advice you should provide more info on which error messages you get. Please turn on debug messages with "$ssh->debug(1);". You could also restart the ssh daemon on the server with a higher log level and have a look at the logfiles there if you believe that the problem source might be found there. Heiko |
From: Heiko J. <ja...@hb...> - 2008-07-07 07:36:33
|
Am Montag, den 07.07.2008, 00:22 -0700 schrieb Vikas Poonia: > > I have one problem in Perl. I need to implement SFTP-Password, > SFTP-Keys,SCP-Password and Scp-Keys in Perl to transfer the file from > one system to another system. I have already implemented ftp and it is > working fine [...] > But for SFTP, SCP etc I am not able to find the function equivalent to > these like new,login,put etc. > does anyone have any sample code or 2-3 lines which explain all these. > I will be hoghly thankful to all of you. I am using > > use Net::SSH2; > > If have any idea about this please let me know. Thanks in Advance Just connect to the remote host with Net::SSH2 (using password or key) and then use the methods scp_get/scp_put of the Net::SSH2 object or retrieve an Net::SSH2::SFTP object by using the method call "sftp" on the Net::SSH2 object. It's all in the Net::SSH2 (or Net::SSH2::SFTP) documentation. The SYNOPSIS paragraph in Net::SSH2 POD even has a (shortened) example for SFTP transfer. Heiko |
From: Vikas P. <vik...@ya...> - 2008-07-07 07:23:11
|
Hello I have one problem in Perl. I need to implement SFTP-Password, SFTP-Keys,SCP-Password and Scp-Keys in Perl to transfer the file from one system to another system. I have already implemented ftp and it is working fine For FTP I have used To login the system:- $ftp=Net::FTP->new("$z_host", Debug => 1); $ftp->login("$z_user", "$z_auth"); To Transfer the file $ftp->put("$p_file_name","$f_ftp") or &idss_error("Error"); But for SFTP, SCP etc I am not able to find the function equivalent to these like new,login,put etc. does anyone have any sample code or 2-3 lines which explain all these. I will be hoghly thankful to all of you. I am using use Net::SSH2; If have any idea about this please let me know. Thanks in Advance |
From: Jean-Marc L. <jea...@ex...> - 2008-07-03 12:03:40
|
To Run on XP In NET::SSH::SFTP.PM Change the line 11 >From use Net::SSH::Perl; to use Net::SSH::W32Perl; And line 60 >From my $ssh = Net::SSH:: Perl->new($sftp->{host}, protocol => 2, To my $ssh = Net::SSH::W32Perl->new($sftp->{host}, protocol => 2, In NET::SSH::PERL::PERL.PM In line 53 Replace : my $proto_class = join '::', _PACKAGE_, By my $proto_class = join '::', 'Net::SSH::W32Perl', You can use use constant IS_WIN32 => ($^O =~ /MSWin32/i); To make this change regards And all will un ************************************************************************************** This e-mail and any attachments may be confidential and/or legally privileged. If you have received this e-mail and you are not a named addressee, please inform the Experian Decision Analytics Service Desk on +377 97 98 54 54 and then delete the e-mail from your system. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail. Although Experian Decision Analytics routinely screens for viruses, addressees should scan this e-mail and any attachments for viruses. Experian Decision Analytics makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of its clients and business, Experian Decision Analytics may monitor and read e-mails sent to and from its servers ************************************************************************************** |
From: Rashid J. <ras...@go...> - 2008-07-01 16:23:59
|
Dear all I have used Perl to some degree in the past, but more recently I am using it more. Goodbye Javasaurus! That being said, I need a little help with the Net related modules. I am trying to transfer some files from a WinXP machine (my PC) to a Solaris box. Alas I get the following error: C:\projects\webbi\gmail>test.pl Connecting to bisdwdbdev... OSTWS0075853: Reading configuration data c:/.ssh/config OSTWS0075853: Reading configuration data /etc/ssh_config OSTWS0075853: Connecting to bisdwdbdev, port 22. OSTWS0075853: Remote version string: SSH-2.0-OpenSSH_4.1 OSTWS0075853: Remote protocol version 2.0, remote software version OpenSSH_4.1 OSTWS0075853: Net::SSH::Perl Version 1.30, protocol version 2.0. OSTWS0075853: *No compat match: OpenSSH_4.1.* *Can't set socket non-blocking*: Bad file descriptor at C:/tools/perl/perl-5.8.8/site/lib/Net/SSH/Perl.pm line 216. My test script is: # sub test_sftp { my $host = DB_SERVER_IP; my $user = DB_SERVER_USERNAME; my $password = DB_SERVER_PASSWORD; my %args = ( user => $user, password => $password, debug => 1, ssh_args => [] ); print "Connecting to $host...\n"; my $sftp = Net::SFTP->new( $host, %args ) || die "Can't connect: $@"; } The error message implies that it is dying in lib/Net/SSH/Perl.pm, here: *"Can't set socket non-blocking: $!"* sub _connect { my $ssh = shift; my $sock = $ssh->_create_socket; my $raddr = inet_aton($ssh->{host}); croak "Net::SSH: Bad host name: $ssh->{host}" unless defined $raddr; my $rport = $ssh->{config}->get('port') || 'ssh'; if ($rport =~ /\D/) { my @serv = getservbyname(my $serv = $rport, 'tcp'); $rport = $serv[2] || 22; } $ssh->debug("Connecting to $ssh->{host}, port $rport."); connect($sock, sockaddr_in($rport, $raddr)) or die "Can't connect to $ssh->{host}, port $rport: $!"; select((select($sock), $|=1)[0]); $ssh->{session}{sock} = $sock; $ssh->_exchange_identification; *## BOMBING OUT HERE:* * defined($sock->blocking(0))* * or die "Can't set socket non-blocking: $!";* $ssh->debug("Connection established."); } I have googled for the posts related to *'No compat match: OpenSSH_4.1'*, but to no avail. Also I couldn't see any relevant examples in the ActiveState port of Perl. The POD perhaps refers to the a Unix port. [i.e. For samples/tutorials, take a look at the scripts in *eg/* in the distribution directory.] I would appreciate any guidance that you chaps can offer. Many thanks in advance Rashid Jeffrey |
From: <moh...@wi...> - 2008-06-25 10:03:45
|
Hi All, I want to call a Perl script (assume test.pl) in VB script (final.vbs). Is it possible to do this? If it is, could you please send me a snippet of the code? Thanks for great help. Regards, Mustafa |
From: <moh...@wi...> - 2008-06-12 15:27:45
|
Hi All, I am trying to install Math::Peri Module on Windows XP with ActivePerl5.10, but getting the following error. I have downloaded the pari moduel (pari-2.3.3.tar.tar) apart from Math::Peri but still getting this below error. Request you to help me out for this. C:\Documents and Settings\mukaa\Mustafa\ssh_files\Math-Pari-2.010800>perl Makefile.PL paridir="C:\Documents and Settings\mukaa\Mustafa\ssh_files\Math-Pari-.010 800\pari" machine=none Setting up Math::Pari with Perl 5.010000 on MSWin32 version 5.00; cc=cl, gccversion=, ccflags='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_ CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', ld=link, ldflags='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C:\Per l\lib\CORE" -machine:x86', optimize='-MD -Zi -DNDEBUG -O1'. Could not extract version from 'C:\Documents and Settings\mukaa\Mustafa\ssh_file s\Math-Pari-2.010800\pari/config/version'; Do you remember that paridir should be location of PARI/GP source tree, not the location of compiled+installed files? Trying extract from the directory name... Directory `C:\Documents and Settings\mukaa\Mustafa\ssh_files\Math-Pari-2.010800\ pari' has unknown syntax... Found GP/PARI build directory in C:\Documents and Settings\mukaa\Mustafa\ssh_fil es\Math-Pari-2.010800\pari (integer-formatted version C:\Documents and Settings\mukaa\Mustafa\ssh_file s\Math-Pari-2.010800\pari). Cannot find tests in C:\Documents and Settings\mukaa\Mustafa\ssh_files\Math-Pari -2.010800\pari/src/test/in: No such file or directory at utils/Math/PariBuild.pm line 513. Regards, Mustafa |
From: <moh...@wi...> - 2008-06-11 15:48:17
|
Hi All, I want to telnet through Perl script from Windows m/c to Linux. Is there any way which we can achieve this without using any ssh module like Net::FTP & Net::SSH::W32Perl? If you have any code snippet please send me across. Thanks for your kind help in advance. Regards, Mustafa |
From: <moh...@wi...> - 2008-06-11 15:44:26
|
Hi All, I want to telnet through Perl script from Windows m/c to Linux. Is there any way which we can achieve this without using any ssh module like Net::FTP & Net::SSH::W32Perl? If you have any code snippet please send me across. Thanks for your kind help in advance. Regards, Mustafa |
From: <moh...@wi...> - 2008-06-06 15:47:46
|
Hi All, Getting error while installing Crypt::DES, I thought it is due to Microsoft VC++, and I installed it successfully but still I am getting the below same error. C:\Documents and Settings\mukaa\Mustafa\ssh_files\Crypt-DES-2.05>nmake Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cl -c -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_ST RICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT _CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"2.05\" -DXS_VERSION=\"2.05\" "-IC:\Perl\lib\CORE" DES.c 'cl' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x1' Stop. Please help me to overcome this issue. Thanks, Mustafa |
From: Uday M. <umo...@me...> - 2008-06-06 15:10:19
|
Your best bet is forums.cacti.net, we can't help you here, this list is for Net::SSH. UM On Fri, Jun 6, 2008 at 11:01 AM, Ibrahim Salloum <sal...@gm...> wrote: > i know that is not the right place for this question. but it s too urgent > for me. > > i wanted to know if somebody knows about cacti. > > i installed cacti and it was working very well and when i tried to import > templates i can t login anymore and this message show up: > > > You are not permitted to access this section of Cacti. If you feel that you > need access to this particular section, please contact the Cacti > administrator. > > thx in advane and i am sorry for the question > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > |
From: Ibrahim S. <sal...@gm...> - 2008-06-06 15:01:09
|
i know that is not the right place for this question. but it s too urgent for me. i wanted to know if somebody knows about cacti. i installed cacti and it was working very well and when i tried to import templates i can t login anymore and this message show up: You are not permitted to access this section of Cacti. If you feel that you need access to this particular section, please contact the Cacti administrator. thx in advane and i am sorry for the question |
From: <moh...@wi...> - 2008-06-03 06:49:05
|
Hi All, I am getting a error while installing CRYPT::DES module at Windows XP, as below, Please let me know how to overcome this? C:\Documents and Settings\mukaa\Mustafa\ssh_files\Crypt-DES-2.05>nmake Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cl -c -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_ST RICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT _CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"2.05\" -DXS_VERSION=\"2.05\" "-IC:\Perl\lib\CORE" DES.c 'cl' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x1' Stop. Regards, Mustafa |
From: Ravi K. <rav...@gm...> - 2008-06-02 22:47:35
|
Hi, I am seeing that connect aborts the script execution when the host is not reachable. Is it possible to make it change this behavior? I would like it to continue so that I can probably check error to see if an error occurred and exit gracefully. I have been unsuccessful in finding any doc/example that handle this error condition. my $ssh = Net::SSH2->new(); $ssh->debug(1); $ssh->connect("1.2.6.6"); if ($ssh->error) { print "cannot connect"; exit; } |