ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 14)
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: Yonatan K. <Yon...@Ka...> - 2008-02-06 17:29:58
|
I'm not getting the full hash back from $sftp->stat($filename) I'm just getting : $VAR1 = 'mtime'; $VAR2 = 3201930; $VAR3 = 'name'; $VAR4 = '/home/path/2/file.txt'; $VAR5 = 'atime'; $VAR6 = 151489008; This doesn't happen all the time, but when it does it all the info hashes come back like this.... Any ideas? I would think it would be an all or nothing sort of deal. Logging into the other server with FileZilla seems to give full info... thanks |
From: Yonatan K. <Yon...@Ka...> - 2008-02-05 15:13:30
|
I have the following code: (edited for easy reading): ----------------- my $ssh2 = new Net::SSH2(); $ssh2->connect($servername().":".$SSH_Port); my $auth_ret_status = $ssh2->auth_password($username,$password ) ; if ($auth_ret_status) { ... OK } else } die...... } my $sftp = $ssh2->sftp(); if (!defined $sftp) { die "error creating SFTP object"; } ---------------- Occasionally the code will die when the $sftp object is not defined. If it's able to get to the point where the login is ok, why can't it create the SFTP object? It not frequent, but it would still be good to know whats going on behind the scenes... thanks |
From: Kevin S. <kev...@gm...> - 2008-02-01 16:46:59
|
On Jan 29, 2008 6:58 AM, Fredrik Stridfeldt <str...@gm...> wrote: > Hello! > > Iam writing a script for automated download and send of files using NET:SFTP. > Just ran into following problem: > > In my sub for fetching files i do like this to figure out what files > are present in the directory on the remote server. > > foreach ($sftp->ls($ddir)) { > next if ($_->{filename} =~ m/^\./); > next if (-d "$ddir\/$_->{filename}"); > push(@files, $_->{filename}); > } > return (@files); > > I exclude . and .. but to exclude the directories i have no success. I > use the same loop with (-d) for excluding directories locally when i > send files and that works with a smile.. > > Best Regards > plura I've used the parse_dir() function from File::Listing for parsing directory lists provided by $sftp->ls() in the past with some success. -- Kevin. |
From: Fredrik S. <str...@gm...> - 2008-01-29 14:25:12
|
NWM next if ($_->{longname} =~ /^d/); did the trick. (sorry if i spam, dont know how to edit/resume on my last post) Best Regards plura On Jan 29, 2008 2:58 PM, Fredrik Stridfeldt <str...@gm...> wrote: > Hello! > > Iam writing a script for automated download and send of files using NET:SFTP. > Just ran into following problem: > > In my sub for fetching files i do like this to figure out what files > are present in the directory on the remote server. > > foreach ($sftp->ls($ddir)) { > next if ($_->{filename} =~ m/^\./); > next if (-d "$ddir\/$_->{filename}"); > push(@files, $_->{filename}); > } > return (@files); > > I exclude . and .. but to exclude the directories i have no success. I > use the same loop with (-d) for excluding directories locally when i > send files and that works with a smile.. > > Best Regards > plura > |
From: Fredrik S. <str...@gm...> - 2008-01-29 13:58:39
|
Hello! Iam writing a script for automated download and send of files using NET:SFTP. Just ran into following problem: In my sub for fetching files i do like this to figure out what files are present in the directory on the remote server. foreach ($sftp->ls($ddir)) { next if ($_->{filename} =~ m/^\./); next if (-d "$ddir\/$_->{filename}"); push(@files, $_->{filename}); } return (@files); I exclude . and .. but to exclude the directories i have no success. I use the same loop with (-d) for excluding directories locally when i send files and that works with a smile.. Best Regards plura |
From: Ian D. <Ian...@bd...> - 2008-01-24 16:55:55
|
Just as a follow up to this, here is the debug log for a manual connection to the two sites. =20 Domain1.com, manual connection =20 $ ssh -v use...@do... OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to domain1 [111.111.111.111] port 22. debug1: Connection established. debug1: identity file /home/username/.ssh/identity type -1 debug1: identity file /home/username/.ssh/id_rsa type 1 debug1: identity file /home/username/.ssh/id_dsa type 2 debug1: Remote protocol version 1.99, remote software version OpenSSH_3.7.1p2 debug1: match: OpenSSH_3.7.1p2 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.9p1 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'domain1' is known and matches the RSA host key. debug1: Found key in /home/username/.ssh/known_hosts:9 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received =20 debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Trying private key: /home/username/.ssh/identity debug1: Offering public key: /home/username/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 149 debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: channel 0: free: client-session, nchannels 1 Connection to domain1 closed by remote host. Connection to domain1 closed. debug1: Transferred: stdin 0, stdout 0, stderr 105 bytes in 0.0 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 5909.2 debug1: Exit status -1 =20 domain2.com manual connection =20 $ ssh -v use...@do... OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to domain2.com [111.111.111.111] port 22. debug1: Connection established. debug1: identity file /home/username/.ssh/identity type -1 debug1: identity file /home/username/.ssh/id_rsa type 1 debug1: identity file /home/username/.ssh/id_dsa type 2 debug1: Remote protocol version 2.0, remote software version JSCAPE3.4.0 debug1: no match: JSCAPE3.4.0 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.9p1 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client 3des-cbc hmac-md5 none debug1: kex: client->server 3des-cbc hmac-md5 none debug1: sending SSH2_MSG_KEXDH_INIT debug1: expecting SSH2_MSG_KEXDH_REPLY debug1: Host 'domain2.com' is known and matches the RSA host key. debug1: Found key in /home/username/.ssh/known_hosts:49 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: password,publickey debug1: Next authentication method: publickey debug1: Trying private key: /home/username/.ssh/identity debug1: Offering public key: /home/username/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 149 debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Entering interactive session. =20 Regards Ian =20 This email is confidential and intended solely for the use of the individ= ual to whom it is addressed. Any views or opinions presented are solely t= hose of the author and do not necessarily represent those of RedBee Media= Metadata. If you are not the intended recipient, be advised that you hav= e received this email in error and that any use, dissemination, forwardin= g, printing, or copying of this email is strictly prohibited. If you have= received this email in error please notify the sender. Red Bee Media Metadata is a trading name of Broadcasting Dataservices Lim= ited.=20 Registered in England and Wales No.: 2554733. Registered Office: 201 Wood= Lane, London W12 7TP, UK.=20 Broadcasting Dataservices Limited is a wholly owned subsidiary of Red Bee= Media Limited. |
From: Ian D. <Ian...@bd...> - 2008-01-24 16:51:49
|
I have a very simple script that connects to a server (domain1) but on trying to configure it to a new site (domain2) I get an error. =20 Manual connection via SSH works OK for both sites, it is just the script that has trouble. Here is the script configured for domain2 =20 #!/usr/bin/perl -w use strict; use warnings; =20 use Net::FTP; use Net::SFTP; =20 my $ftp; =20 eval { $ftp =3D Net::SFTP->new('domain2.com', user =3D> 'myuser', debug =3D> 1, ); }; =20 if ($@) { print "login failed [$@]\n"; } 1; =20 Error output is =20 login failed [Key class 'Net::SSH::Perl::Key::RSA' is unsupported: Can't locate Compress/Raw/Zlib.pm in @INC (@INC contains: <snip> .) at /work/perl-modules/lib/Compress/Zlib.pm line 12. BEGIN failed--compilation aborted at /work/perl-modules/lib/Compress/Zlib.pm line 12. Compilation failed in require at /work/perl-modules/lib/Convert/ASCII/Armour.pm line 15. BEGIN failed--compilation aborted at /work/perl-modules/lib/Convert/ASCII/Armour.pm line 15. Compilation failed in require at /work/perl-modules/lib/Crypt/RSA.pm line 20. BEGIN failed--compilation aborted at /work/perl-modules/lib/Crypt/RSA.pm line 20. Compilation failed in require at /work/perl-modules/lib/Net/SSH/Perl/Key/RSA.pm line 15. BEGIN failed--compilation aborted at /work/perl-modules/lib/Net/SSH/Perl/Key/RSA.pm line 15. Compilation failed in require at (eval 24) line 1. BEGIN failed--compilation aborted at (eval 24) line 1. =20 The point here is that we have never had to use Compress::Zlib before (on any of our other site connections) so why do we need it now. (Installing it does not seem to be an option for reasons I don't want to go into at the moment!) =20 Comparing the full (debug) output from the two servers, here is the output for the successful connection. =20 localhost: Reading configuration data /home/username/.ssh/config localhost: Reading configuration data /etc/ssh_config localhost: Connecting to domain1.com, port 22. localhost: Remote version string: SSH-1.99-OpenSSH_3.7.1p2 =20 localhost: Remote protocol version 1.99, remote software version OpenSSH_3.7.1p2 localhost: Net::SSH::Perl Version 1.30, protocol version 2.0. localhost: No compat match: OpenSSH_3.7.1p2. localhost: Connection established. localhost: Sent key-exchange init (KEXINIT), wait response. localhost: Algorithms, c->s: 3des-cbc hmac-sha1 none localhost: Algorithms, s->c: 3des-cbc hmac-sha1 none localhost: Entering Diffie-Hellman Group 1 key exchange. localhost: Sent DH public key, waiting for reply. localhost: Received host key, type 'ssh-dss'. localhost: Host 'domain1.com' is known and matches the host key. localhost: Computing shared secret key. localhost: Verifying server signature. localhost: Waiting for NEWKEYS message. localhost: Enabling incoming encryption/MAC/compression. localhost: Send NEWKEYS, enable outgoing encryption/MAC/compression. localhost: Sending request for user-authentication service. localhost: Service accepted: ssh-userauth. localhost: Trying empty user-authentication request. localhost: Authentication methods that can continue: publickey,password,keyboard-interactive. localhost: Next method to try is publickey. localhost: Trying pubkey authentication with key file '/home/username/.ssh/id_dsa' localhost: Login completed, opening dummy shell channel. localhost: channel 0: new [client-session] localhost: Requesting channel_open for channel 0. localhost: channel 0: open confirm rwindow 0 rmax 32768 localhost: channel 1: new [client-session] localhost: Requesting channel_open for channel 1. localhost: Sending subsystem: sftp localhost: Requesting service subsystem on channel 1. localhost: channel 1: open confirm rwindow 0 rmax 32768 localhost: sftp: Sending SSH2_FXP_INIT localhost: sftp: Remote version: 3 =20 Whereas here is the full output for the failed connection. =20 localhost: Reading configuration data /home/username/.ssh/config localhost: Reading configuration data /etc/ssh_config localhost: Connecting to domain2.com, port 22. localhost: Remote version string: SSH-2.0-JSCAPE3.4.0 =20 localhost: Remote protocol version 2.0, remote software version JSCAPE3.4.0 localhost: Net::SSH::Perl Version 1.30, protocol version 2.0. localhost: No compat match: JSCAPE3.4.0 localhost: Connection established. localhost: Sent key-exchange init (KEXINIT), wait response. localhost: Algorithms, c->s: 3des-cbc hmac-sha1 none localhost: Algorithms, s->c: 3des-cbc hmac-sha1 none localhost: Entering Diffie-Hellman Group 1 key exchange. localhost: Sent DH public key, waiting for reply. login failed [Key class 'Net::SSH::Perl::Key::RSA' is unsupported: Can't locate Compress/Raw/Zlib.pm in @INC (@INC contains: <snip> .) at /work/perl-modules/lib/Compress/Zlib.pm line 12. BEGIN failed--compilation aborted at /work/perl-modules/lib/Compress/Zlib.pm line 12. Compilation failed in require at /work/perl-modules/lib/Convert/ASCII/Armour.pm line 15. BEGIN failed--compilation aborted at /work/perl-modules/lib/Convert/ASCII/Armour.pm line 15. Compilation failed in require at /work/perl-modules/lib/Crypt/RSA.pm line 20. BEGIN failed--compilation aborted at /work/perl-modules/lib/Crypt/RSA.pm line 20. Compilation failed in require at /work/perl-modules/lib/Net/SSH/Perl/Key/RSA.pm line 15. BEGIN failed--compilation aborted at /work/perl-modules/lib/Net/SSH/Perl/Key/RSA.pm line 15. Compilation failed in require at (eval 24) line 1. BEGIN failed--compilation aborted at (eval 24) line 1. =20 What then is likely to be the difference between domain1.com and domain2.com that is causing our local script To fail in this way? =20 Regards Ian This email is confidential and intended solely for the use of the individ= ual to whom it is addressed. Any views or opinions presented are solely t= hose of the author and do not necessarily represent those of RedBee Media= Metadata. If you are not the intended recipient, be advised that you hav= e received this email in error and that any use, dissemination, forwardin= g, printing, or copying of this email is strictly prohibited. If you have= received this email in error please notify the sender. Red Bee Media Metadata is a trading name of Broadcasting Dataservices Lim= ited.=20 Registered in England and Wales No.: 2554733. Registered Office: 201 Wood= Lane, London W12 7TP, UK.=20 Broadcasting Dataservices Limited is a wholly owned subsidiary of Red Bee= Media Limited. |
From: Mik J <mik...@ya...> - 2008-01-18 16:53:24
|
Hi, I have some network equipements (extreme networks) on which I'm able to use the Net::SCP perl module. ** I made a little test script that works #!/usr/bin/perl use Net::SFTP; my $cisco = '10.1.1.1'; my $extreme = '10.2.2.2.2'; #my $host = $cisco; my $host = $extreme; my $user = "mikydevel"; my $password = "mypass"; my %table; $table{debug} = 1; $table{interactive} = 0; $table{"user"} = $user; $table{"password"} = $password; use Net::SFTP; my $sftp = Net::SFTP->new($host,%table); $sftp->get("configuration.cfg", "CONFIG.RUN"); ** I try to implement this functionality in my existing script I have a sub that calls the net_scp_extreme sub if the type of connection is scp elsif ($connexion eq 'scp') { my $thr = threads->new('net_scp_extreme', $ip, $host, $pf, $device, $login, $pass, $enable); $thr->detach(); } and the sub looks like this, some variable such as $host or $pf are passed to the sub just for error information sub net_scp_extreme { my ($ip, $host, $pf, $device, $login, $pass, $enable) = @_; my $session; my %parametres; my $sftp; my %table; $table{debug} = 1; $table{interactive} = 0; $table{"user"} = $login; $table{"password"} = $pass; my $sftp = Net::SFTP->new($ip,%table); $sftp->get("configuration.cfg", "R02.RUN"); $nb_routeur++; return; } When I run the script I have this error message host: Remote protocol version 2.0, remote software version 2.0.12 (non-commercial) host: Net::SSH::Perl Version 1.30, protocol version 2.0. ' matches pattern '^2\.0\.'.2.0.12 (non-commercial) thread failed to start: Can't locate object method "blocking" via package "FileHandle" at /usr/lib/perl5/site_perl/5.8.5/Net/SSH/Perl.pm line 216, <LISTE> line 1. Segmentation fault line 216 corresponds to the line below defined($sock->blocking(0)) or die "Can't set socket non-blocking: $!"; <LISTE> line 1 correspond to a desciptor associated with a file that I use for input. It contains the IP, hostname, login, password etc When I comment these two lines defined($sock->blocking(0)) or die "Can't set socket non-blocking: $!"; the script goes further and segfault later NB: When I want to share a variable between threads I use use threads; use threads::shared; my $nb_routeur : shared = 0; and all the threads are able to increment the variable $nb_routeur To sum up my problem, the implementation of Net:SCP inside threads doesn't work. Does anybody ever had this problem ? _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr |
From: Mik J <mik...@ya...> - 2008-01-18 16:23:22
|
--- Heiko Jansen <ja...@hb...> a écrit : > Am Mittwoch, den 16.01.2008, 23:13 +0100 schrieb Mik > J: > > > > > I'd suggest using Net::SCP (which is only a > wrapper > > > around the command line scp) > > > > I can't use the Net::SCP for the reason below > > "Q: How do you supply a password to connect with > ssh > > within a perl script using the Net::SSH module? > > A: You don't (at least not with this module). Use > RSA > > or DSA keys. See the quick help in the next > section > > and the ssh-keygen(1) manpage. > > A #2: See Net::SCP::Expect instead. > > " > > My routers accept only password authentication. > > So you try Net::SCP::Expect instead, as proposed. > > > I did not manage to make Net::SSH2 with the scp > option > > to work when trying to secure copy my router's > > configuration. > > > > #!/usr/bin/perl > > use Net::SSH2; > > $cisco = '10.1.1.1'; > > $user = 'miky'; > > $pass = 'mypass'; > > $cfg_run = 'RUNCFG'; > > $cisco_run = 'running-config'; > > my $ssh2 = Net::SSH2->new(); > > $ssh2->debug(1); > > $ssh2->connect($cisco) or warn "Can't open > connection > > to $host\n"; > > $ssh2->auth_password($user, $pass); > > $ssh2->scp_get($cisco_run,$cfg_run); > > print "\n"; > > > > > > $ ./scpcisco.pl > > libssh2_scp_recv(ss->session, path, &st) -> 0x0 > > Net::SSH2::DESTROY object 0x80e0d40 > > and the file RUNCFG is not created > > First, make sure you have libssh2 0.18 and Net::SSH2 > 0.18. Previous > versions had problems. I was using the 0.17 version > Even though I have these versions your script did > not work for me at > first either: when I started it, it simply hang > without printing any > debug messages... > I had to replace "auth_password" with > "auth_keyboard" to get it to work. I made this replacement but it did not work My script already works with Net::Telnet::Cisco or Net::Telnet but I wanted it to work with a secure protocol such as ssh. I didn't try to make it work with snmp because I dont know much about this protocol except that it's quite difficult to make things due to different OID on different IOS Thanx for you two, I guess that it won't work this way. I'm working on the other side with Net::Appliance::Session through ssh (not scp) _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr |
From: Torben P. E. <TP...@da...> - 2008-01-17 22:01:30
|
Cisco routers have build in backup capabilities. You could use SNMP to make the router push it's configuration with TFTP, = FTP or SCP. http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_feature_g= uide09186a00801a75a3.html By the way. Cisco recommends using a separate VLAN for management and = backup. So telnet would be a option with that solution.=20 -----Oprindelig meddelelse----- Fra: ssh...@li... = [mailto:ssh...@li...] P=E5 vegne af = Mik J Sendt: 16. januar 2008 23:13 Til: ssh...@li... Emne: [Ssh-sftp-perl-users] RE : Re: Scp capability but no sftp = capability |
From: Heiko J. <ja...@hb...> - 2008-01-17 08:24:31
|
Am Donnerstag, den 17.01.2008, 09:20 +0100 schrieb Heiko Jansen: > So you try Net::SCP::Expect instead, as proposed. Should have been "So you _could_ try..." By the way: If "auth_keyboard" does not work, I don't have any other ideas about what might help. Maybe the router has a log where one could find hints on what's going wrong. Otherwise: Real experts to the rescue ;-) heiko |
From: Heiko J. <ja...@hb...> - 2008-01-17 08:20:46
|
Am Mittwoch, den 16.01.2008, 23:13 +0100 schrieb Mik J: > > > I'd suggest using Net::SCP (which is only a wrapper > > around the command line scp) > > I can't use the Net::SCP for the reason below > "Q: How do you supply a password to connect with ssh > within a perl script using the Net::SSH module? > A: You don't (at least not with this module). Use RSA > or DSA keys. See the quick help in the next section > and the ssh-keygen(1) manpage. > A #2: See Net::SCP::Expect instead. > " > My routers accept only password authentication. So you try Net::SCP::Expect instead, as proposed. > I did not manage to make Net::SSH2 with the scp option > to work when trying to secure copy my router's > configuration. > > #!/usr/bin/perl > use Net::SSH2; > $cisco = '10.1.1.1'; > $user = 'miky'; > $pass = 'mypass'; > $cfg_run = 'RUNCFG'; > $cisco_run = 'running-config'; > my $ssh2 = Net::SSH2->new(); > $ssh2->debug(1); > $ssh2->connect($cisco) or warn "Can't open connection > to $host\n"; > $ssh2->auth_password($user, $pass); > $ssh2->scp_get($cisco_run,$cfg_run); > print "\n"; > > > $ ./scpcisco.pl > libssh2_scp_recv(ss->session, path, &st) -> 0x0 > Net::SSH2::DESTROY object 0x80e0d40 > and the file RUNCFG is not created First, make sure you have libssh2 0.18 and Net::SSH2 0.18. Previous versions had problems. Even though I have these versions your script did not work for me at first either: when I started it, it simply hang without printing any debug messages... I had to replace "auth_password" with "auth_keyboard" to get it to work. However, I could test that only with a linux server running OpenSSH - I do not have a cisco router here for testing so my solution might no be applicable to your environment. Heiko |
From: Mik J <mik...@ya...> - 2008-01-16 22:13:43
|
Thank you, --- Heiko Jansen <ja...@hb...> a écrit : > > I have a Cisco router on which I'm able to scp the > > configuration file in command line but sftp > > doesn't work from the command line. > > I'd like to know if Net::SFTP is able to connect > > to the routeur in the scp mode only not using the > > sftp functionality. > > From what I see in the docs, I'd say no. Besides, > it is explicitly named Net::SFTP... I read correctly the name of this module and I know it's SFTP. But it seemed strange to me that there was a SSH module, a SFTP module and no SCP. I thought the SCP functionality was included in the SFTP module. > I'd suggest using Net::SCP (which is only a wrapper > around the command line scp) I can't use the Net::SCP for the reason below "Q: How do you supply a password to connect with ssh within a perl script using the Net::SSH module? A: You don't (at least not with this module). Use RSA or DSA keys. See the quick help in the next section and the ssh-keygen(1) manpage. A #2: See Net::SCP::Expect instead. " My routers accept only password authentication. > or - presumably even > better - Net::SSH2 which has a built-in > scp subcommand. I did not manage to make Net::SSH2 with the scp option to work when trying to secure copy my router's configuration. #!/usr/bin/perl use Net::SSH2; $cisco = '10.1.1.1'; $user = 'miky'; $pass = 'mypass'; $cfg_run = 'RUNCFG'; $cisco_run = 'running-config'; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect($cisco) or warn "Can't open connection to $host\n"; $ssh2->auth_password($user, $pass); $ssh2->scp_get($cisco_run,$cfg_run); print "\n"; $ ./scpcisco.pl libssh2_scp_recv(ss->session, path, &st) -> 0x0 Net::SSH2::DESTROY object 0x80e0d40 and the file RUNCFG is not created _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr |
From: Heiko J. <ja...@hb...> - 2008-01-16 14:12:53
|
Am Mittwoch, den 16.01.2008, 14:57 +0100 schrieb Mik J: > I have a Cisco router on which I'm able to scp the > configuration file in command line but sftp doesn't > work from the command line. > I'd like to know if Net::SFTP is able to connect to > the routeur in the scp mode only not using the sftp > functionality. >From what I see in the docs, I'd say no. Besides, it is explicitly named Net::SFTP... > Does anyone tryed to do this or know how to retrive a > file from a system that doesn't support sftp ? I'd suggest using Net::SCP (which is only a wrapper around the command line scp) or - presumably even better - Net::SSH2 which has a built-in scp subcommand. heiko |
From: Mik J <mik...@ya...> - 2008-01-16 13:58:08
|
Hello, I have a Cisco router on which I'm able to scp the configuration file in command line but sftp doesn't work from the command line. I'd like to know if Net::SFTP is able to connect to the routeur in the scp mode only not using the sftp functionality. Does anyone tryed to do this or know how to retrive a file from a system that doesn't support sftp ? _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr |
From: David M. F. <mf...@tr...> - 2007-12-31 00:10:16
|
Folks, I want to ssh into my aix server and run the passwd interactive command to change password automatically. However, The waitfor never works correctly. It always dies with prompt 'Password:' not found after 1 seconds Actual ssh session: Server1[/home/user1]$ sudo passwd user2 Password: Changing password for "user2" user2's New password: Enter the new password again: Code snippet: use Net::SSH::Expect; my $ssh = Net::SSH::Expect->new ( host => "$sship", port => 22, password=> "$pass", user => "$user", raw_pty => 1 ); # 2) logon to the SSH server using those credentials. # test the login output to make sure we had success my $login_output = $ssh->login(); print "Login Output->$login_output<-\n"; if ($login_output !~ /Wlecome/) { die "Login has failed. Login output was $login_output"; } else { print "Login Successful!!\n"; } # Now let's run an interactive command, like passwd. # This is done combining send() and waitfor() methods together: print "Sending Command->sudo passwd $userid<-\n"; $ssh->exec("sudo passwd $userid"); $ssh->waitfor('Password:', 1) or die "prompt 'Password:' not found after 1 seconds"; print "Sending Password->$pass<-\n"; $ssh->send("$pass"); $ssh->waitfor('New password:\s*\z', 1) or warn "prompt 'New password:' not found"; print "Sending Temporary Password->$temp_pass<-\n"; $ssh->exec("$temp_pass"); $ssh->waitfor('new password again:\s*\z', 1) or warn "prompt 'Confirm new password:' not found"; print "Sending Temporary Password again->$temp_pass<-\n"; $ssh->exec("$temp_pass"); # check that we have the system prompt again. $ssh->waitfor('$\s*\z', 1) or warn "No System Prompt\n"; $ssh->send("exit"); # closes the ssh connection $ssh->close(); } 1; TIA, Mark |
From: K B S. K. <shi...@in...> - 2007-12-11 16:02:10
|
> Hi, > > Thanks in advance. In case the answer is RTFM... I request you to > please please point me to the FM. > > I have an Fedora Core 3 and have installed Net::SSH::Perl successfully > from CPAN. I am using password authentication. However my script fails > during Diffie Hellman Group 1 Key Exchange with Bad Packet Length > Error. I am successfully able to connect via command line using > password authentication. > > Below is the verbose output of Net::SSH::Perl > > mustang: Reading configuration data /root/.ssh/config > mustang: Reading configuration data /etc/ssh_config > mustang: Allocated local port 1023. > mustang: Connecting to 192.168.14.79, port 22. > mustang: Remote version string: SSH-1.99-OpenSSH_3.9p1 > > mustang: Remote protocol version 1.99, remote software version > OpenSSH_3.9p1 > mustang: Net::SSH::Perl Version 1.30, protocol version 2.0. > mustang: No compat match: OpenSSH_3.9p1. > mustang: Connection established. > mustang: Sent key-exchange init (KEXINIT), wait response. > mustang: Algorithms, c->s: blowfish-cbc hmac-sha1 none > mustang: Algorithms, s->c: blowfish-cbc hmac-sha1 none > mustang: Entering Diffie-Hellman Group 1 key exchange. > mustang: Sent DH public key, waiting for reply. > Received disconnect message: Bad packet length 167772160. > at /usr/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/Kex/DH1.pm line 41 > > > Here is the output (debug3) of the server. > > Dec 11 20:47:08 mustang sshd[3321]: debug3: fd 4 is not O_NONBLOCK > Dec 11 20:47:08 mustang sshd[3362]: debug1: rexec start in 4 out 4 > newsock 4 pipe 6 sock 7 > Dec 11 20:47:08 mustang sshd[3321]: debug1: Forked child 3362. > Dec 11 20:47:08 mustang sshd[3321]: debug3: send_rexec_state: entering > fd = 7 config len 367 > Dec 11 20:47:08 mustang sshd[3321]: debug3: ssh_msg_send: type 0 > Dec 11 20:47:08 mustang sshd[3321]: debug3: send_rexec_state: done > Dec 11 20:47:08 mustang sshd[3362]: debug1: inetd sockets after > dupping: 3, 3 > Dec 11 20:47:08 mustang sshd[3362]: Connection from 192.168.14.79 port > 1023 > Dec 11 20:47:08 mustang sshd[3362]: debug1: Client protocol version > 2.0; client software version 1.30 > Dec 11 20:47:08 mustang sshd[3362]: debug1: no match: 1.30 > Dec 11 20:47:08 mustang sshd[3362]: debug1: Enabling compatibility > mode for protocol 2.0 > Dec 11 20:47:08 mustang sshd[3362]: debug1: Local version string > SSH-1.99-OpenSSH_3.9p1 > Dec 11 20:47:08 mustang sshd[3362]: debug2: fd 3 setting O_NONBLOCK > Dec 11 20:47:08 mustang sshd[3362]: debug2: Network child is on pid > 3363 > Dec 11 20:47:08 mustang sshd[3362]: debug3: preauth child monitor > started > Dec 11 20:47:08 mustang sshd[3362]: debug3: mm_request_receive > entering > Dec 11 20:47:08 mustang sshd[3362]: debug1: do_cleanup > Dec 11 20:47:08 mustang sshd[3362]: debug1: PAM: cleanup > Dec 11 20:47:08 mustang sshd[3362]: debug3: PAM: sshpam_thread_cleanup > entering > > Shiv |
From: B. <ism...@fr...> - 2007-12-07 17:17:31
|
Hi, Sorry but maybe this question is Debian-specific : I try to complie libssh2-0.18 under Debian etch : ./configure --with-openssl=/usr/bin/openssl and it ends with : configure: error: Missing one or more of <openssl/bn.h>, <openssl/evp.h>, <openssl/hmac.h>, <openssl/pem.h>, <openssl/sha.h> Thse packages are installed : ii libssl0.9.8 0.9.8e-6 SSL shared libraries ii openssl 0.9.8e-5 Secure Socket Layer (SSL) binary and related but I don't succeesd in installing libssl-dev, it tells me : apt-get install libssl-dev "Les paquets suivants contiennent des dépendances non satisfaites : libssl-dev: Dépend: libssl0.9.8 (= 0.9.8c-4etch1) mais 0.9.8e-6 devra être installé Dépend: zlib1g-dev mais ne sera pas installé E: Paquets défectueux" In english, non satisfied dependancies !! I try to make this to install in order Net::SSH2 (0.18) ! |
From: B. <ism...@fr...> - 2007-12-06 08:55:33
|
I download the last libssh2(0.18) from libssh2.org and Net::SSH2 installs well. Selon Ismaël BALLO <ism...@fr...>: > Hi, > > I've got on my box an old version of Net-SSH2 (0.05) > I made a fresh install of : > > - libssh2-devel-0.17-1.fc4.rf.i386.rpm > - libssh2-0.17-1.fc4.rf.i386.rpm > with success, zlib and openssl are well install > and try to install the last published module : > > 1/ perl Makefile.PL exits correctly but doing make test gives me that : > > > [root@admin Net-SSH2-0.18]# make > gcc -c -I/usr/local/include -I. -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING > -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE > -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe > -Wp,-D_FORTIFY_SOURCE=2 > -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables > -DVERSION=\"0.18\" -DXS_VERSION=\"0.18\" -fPIC > "-I/usr/lib/perl5/5.8.6/i386-linux-thread-multi/CORE" SSH2.c > SSH2.xs: In function âXS_Net__SSH2_versionâ: > SSH2.xs:579: erreur: âLIBSSH2_VERSION_NUMâ undeclared (first use in this > function) > SSH2.xs:579: erreur: (Chaque identificateur non déclaré est rapporté une > seule fois > SSH2.xs:579: erreur: pour chaque fonction dans laquelle il apparaît.) > SSH2.xs: In function âXS_Net__SSH2__PublicKey_addâ: > SSH2.xs:1741: attention : pointer targets in passing argument 2 of > âlibssh2_publickey_add_exâ differ in signedness > SSH2.xs:1741: attention : pointer targets in passing argument 4 of > âlibssh2_publickey_add_exâ differ in signedness > SSH2.xs: In function âXS_Net__SSH2__PublicKey_removeâ: > SSH2.xs:1755: attention : pointer targets in passing argument 2 of > âlibssh2_publickey_remove_exâ differ in signedness > SSH2.xs:1755: attention : pointer targets in passing argument 4 of > âlibssh2_publickey_remove_exâ differ in signedness > make: *** [SSH2.o] Erreur 1 > > > Can someone help me ? > > Thx. > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: The Future of Linux Business White Paper > from Novell. From the desktop to the data center, Linux is going > mainstream. Let it simplify your IT future. > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > |
From: B. <ism...@fr...> - 2007-12-05 16:50:47
|
Hi, I've got on my box an old version of Net-SSH2 (0.05) I made a fresh install of : - libssh2-devel-0.17-1.fc4.rf.i386.rpm - libssh2-0.17-1.fc4.rf.i386.rpm with success, zlib and openssl are well install and try to install the last published module : 1/ perl Makefile.PL exits correctly but doing make test gives me that : [root@admin Net-SSH2-0.18]# make gcc -c -I/usr/local/include -I. -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -DVERSION=\"0.18\" -DXS_VERSION=\"0.18\" -fPIC "-I/usr/lib/perl5/5.8.6/i386-linux-thread-multi/CORE" SSH2.c SSH2.xs: In function âXS_Net__SSH2_versionâ: SSH2.xs:579: erreur: âLIBSSH2_VERSION_NUMâ undeclared (first use in this function) SSH2.xs:579: erreur: (Chaque identificateur non déclaré est rapporté une seule fois SSH2.xs:579: erreur: pour chaque fonction dans laquelle il apparaît.) SSH2.xs: In function âXS_Net__SSH2__PublicKey_addâ: SSH2.xs:1741: attention : pointer targets in passing argument 2 of âlibssh2_publickey_add_exâ differ in signedness SSH2.xs:1741: attention : pointer targets in passing argument 4 of âlibssh2_publickey_add_exâ differ in signedness SSH2.xs: In function âXS_Net__SSH2__PublicKey_removeâ: SSH2.xs:1755: attention : pointer targets in passing argument 2 of âlibssh2_publickey_remove_exâ differ in signedness SSH2.xs:1755: attention : pointer targets in passing argument 4 of âlibssh2_publickey_remove_exâ differ in signedness make: *** [SSH2.o] Erreur 1 Can someone help me ? Thx. |
From: <eri...@wa...> - 2007-11-21 16:35:14
|
I will be out of the office starting 11/19/2007 and will not return until 11/23/2007. I will respond to your message when I return. If its an emergency please contact Bill Lockley, Don Boenitz, or Tim Delrose. |
From: Heiko J. <ja...@hb...> - 2007-11-21 16:32:46
|
Am Mittwoch, den 21.11.2007, 18:07 +0200 schrieb Yonatan Katchen: > I succesfully ran make Net::SSH2 0.18 against libssh2 0.18 but the "make > test" fails on the first test with this message: > > I verified that both the files in the "Can't load" are there. > Any ideas on what's wrong? Did you do anything special to tell "make" where to find libssh2? Or is libssh2 installed in a common path (/usr/lib, /usr/local/lib)? If not, maybe you could try ~> LD_LIBRARY_PATH=<PathToLibSsh2SoDirectory>:$LD_LIBRARY make test and see what happens... If that helps and you don't have plans to put libssh2 in a standard path you could try to link Net::SSH2 with "-R<PathToLibSsh2SoDirectory>" (cf. "man ld" and the option -R (or -rpath). Heiko |
From: Yonatan K. <Yon...@Ka...> - 2007-11-21 16:07:51
|
I succesfully ran make Net::SSH2 0.18 against libssh2 0.18 but the "make test" fails on the first test with this message: I verified that both the files in the "Can't load" are there. Any ideas on what's wrong? thanks _______ $make test PERL_DL_NONLAZY=3D1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/Net-SSH2.... # Failed test 'use Net::SSH2;' t/Net-SSH2....NOK 1/72# at t/Net-SSH2.t line 19. # Tried to use 'Net::SSH2'. # Error: Can't load '/home/yok/tmp/Net-SSH2-0.18/blib/arch/auto/Net/SSH2/SSH2.so' for module Net::SSH2: libssh2.so.1: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229. # at (eval 3) line 2 # Compilation failed in require at (eval 3) line 2. # BEGIN failed--compilation aborted at t/Net-SSH2.t line 19. &Net::SSH2::constant not defined at t/Net-SSH2.t line 22 # Looks like you planned 72 tests but only ran 1. # Looks like you failed 1 test of 1 run. # Looks like your test died just after 1. t/Net-SSH2....dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 1-72 Failed 72/72 tests, 0.00% okay |
From: David R. <dbr...@cp...> - 2007-11-14 03:59:24
|
With this release I've cleaned out my Net::SSH2 email and rt.cpan.org backlog; changelist entry follows. It's available at http://search.cpan.org/~dbrobins/Net-SSH2. 0.18 2007-11-10 dbr (svn revision 56) - Note version change: synced to libssh2. Should be compatible with libssh2 0.16+, including future versions provided API remains stable. - Documented Net::SSH2::version class method. - Removed references to LIBSSH2_APINO (removed in libssh2 0.16); fixes rt.cpan.org #28722. - Fixed memory leak in poll (rt.cpan.org #27368, based on patch from David Sullivan). - Fixed 0-valued POSIX flag translation bug (based on patch from Joseph Galbraith). - Check lib64 as well as lib for libraries (patch from Leo Eraly). - Add blocking method to Net::SSH2 object. -- Dave Isa. 40:31 |
From: Heiko J. <ja...@hb...> - 2007-11-11 11:35:49
|
Hi Radu. libssh2 0.18 has just been released with a number of bug fixes in this = area. If your problems aren=C2=B4t related to changes in the API (which would = require changes in Net::SSH2, too) there might be a chance that they=C2=B4re gone = now. Regards Heiko |