ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 39)
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: Marschall P. <pet...@is...> - 2003-11-21 08:01:40
|
Hi , I have a problem with Net::SFTP / Net::SSH::Perl (both the old and the current versions) on Perl 5.6.0 and Linux 2.4.x The attached program sftptest.pl tries to connect to a server and do a simple 'ls' there. It works absolutely flawlessly when run interactively by a regular user, but when the very same user tries to run it from cron he does not get any answers from the server. Another strange behaviour: when root tries to run the program from cron it works as expected. It happens on three machines with similar (but not identical) setup. The attached files sftptest-interactive.log and sftptest-via-cron.log show the differences. They result from a shell script that calls sftptest.pl after setting all environment variables to the values from the cron environment. Somehow the connection seems to get closed at about the time when SSH2_FXP_INIT gets sent. Can you give me any hint or clue how to make Net::SFTP run from cron too ? I'd really love to use Net::SFTP instead of doing some dirty tricks with Expect or calling the sftp program directly. Thanks in advance for your help Peter Marschall -------------- sftptest.pl ------------------ #!/usr/bin/perl -w use Net::SFTP; use strict; my $server = $ARGV[0] || ''; my $user = $ARGV[1] || ''; my $password = $ARGV[2] || ''; my $dir = $ARGV[3] || ''; my @result = (); print STDERR "Environment:\n"; map { print STDERR "\t$_ = $ENV{$_}\n"; } keys(%ENV); print STDERR "Specials:\n"; print STDERR "\t\$\$ = ". (defined($$) ? $$ : '<undef>') ."\n"; print STDERR "\t\$\< = ". (defined($<) ? $< : '<undef>') ."\n"; print STDERR "\t\$\> = ". (defined($>) ? $> : '<undef>') ."\n"; print STDERR "\t\$\/ = ". (defined($/) ? $/ : '<undef>') ."\n"; print STDERR "\t\$\\ = ". (defined($\) ? $\ : '<undef>') ."\n"; print STDERR "\t\$\~ = ". (defined($~) ? $~ : '<undef>') ."\n"; print STDERR "\t\$\% = ". (defined($%) ? $% : '<undef>') ."\n"; print STDERR "\t\$\= = ". (defined($=) ? $= : '<undef>') ."\n"; print STDERR "\t\$\- = ". (defined($-) ? $- : '<undef>') ."\n"; print STDERR "\t\$\, = ". (defined($,) ? $, : '<undef>') ."\n"; print STDERR "\t\$\| = ". (defined($|) ? $| : '<undef>') ."\n"; print STDERR "\t\$\! = ". (defined($!) ? $! : '<undef>') ."\n"; print STDERR "\t\$\? = ". (defined($?) ? $? : '<undef>') ."\n"; my $sftp = Net::SFTP->new($server, user => $user || '', password => $password || '', debug => 1) or die "error creating SFTP object: $@"; die "ls: $@" if (!defined(eval { @result = $sftp->ls($dir) })); print STDERR "Files:\n"; map { print STDERR "\t".$_->{filename}."\n"; } @result; # EOF -------------- sftptest-interactive.log ------------------ Environment: _ = /usr/local/src/Meta/test/sftptest.pl HOSTTYPE = i386 HOME = /home/metaconn SHLVL = 1 OSTYPE = linux TERM = dumb PWD = /home/metaconn HOSTNAME = lx0042 MACHTYPE = i386-suse-linux LOGNAME = metaconn PATH = /usr/bin:/bin SHELL = /bin/sh Specials: $$ = 22827 $< = 500 $> = 500 $/ = $\ = <undef> $~ = STDOUT $% = 0 $= = 60 $- = 0 $, = <undef> $| = 0 $! = $? = 0 lx0042: Reading configuration data /home/metaconn/.ssh/config lx0042: Reading configuration data /etc/ssh_config lx0042: Connecting to sl00028.weimar.teagnetkom.de, port 22. lx0042: Remote protocol version 1.99, remote software version OpenSSH_3.5p1 lx0042: Net::SSH::Perl Version 1.24, protocol version 2.0. lx0042: No compat match: OpenSSH_3.5p1. lx0042: Connection established. lx0042: Sent key-exchange init (KEXINIT), wait response. lx0042: Algorithms, c->s: 3des-cbc hmac-sha1 none lx0042: Algorithms, s->c: 3des-cbc hmac-sha1 none lx0042: Entering Diffie-Hellman Group 1 key exchange. lx0042: Sent DH public key, waiting for reply. lx0042: Received host key, type 'ssh-dss'. lx0042: Host 'sl00028.weimar.teagnetkom.de' is known and matches the host key. lx0042: Computing shared secret key. lx0042: Verifying server signature. lx0042: Waiting for NEWKEYS message. lx0042: Enabling incoming encryption/MAC/compression. lx0042: Send NEWKEYS, enable outgoing encryption/MAC/compression. lx0042: Sending request for user-authentication service. lx0042: Service accepted: ssh-userauth. lx0042: Trying empty user-authentication request. lx0042: Authentication methods that can continue: publickey,password. lx0042: Next method to try is publickey. lx0042: Next method to try is password. lx0042: Trying password authentication. lx0042: Login completed, opening dummy shell channel. lx0042: channel 0: new [client-session] lx0042: Requesting channel_open for channel 0. lx0042: channel 0: open confirm rwindow 0 rmax 32768 lx0042: Got channel open confirmation, requesting shell. lx0042: Requesting service shell on channel 0. lx0042: channel 1: new [client-session] lx0042: Requesting channel_open for channel 1. lx0042: Sending subsystem: sftp lx0042: Requesting service subsystem on channel 1. lx0042: channel 1: open confirm rwindow 0 rmax 32768 lx0042: sftp: Sending SSH2_FXP_INIT lx0042: sftp: Remote version: 3 lx0042: sftp: Sent message T:11 I:0 lx0042: sftp: Sent message T:12 I:1 lx0042: sftp: Received reply T:104 I:1 lx0042: sftp: Received 30 SSH2_FXP_NAME responses lx0042: sftp: Sent message T:12 I:2 lx0042: sftp: Received reply T:101 I:2 lx0042: sftp: Received SSH2_FXP_STATUS 1 lx0042: sftp: Sent message T:4 I:3 Files: . .. dms_mobil_031101223038.txt dms_mobil_031106223039.txt dms_mobil_031102223038.txt dms_mobil_031103223037.txt dms_mobil_031108223038.txt dms_mobil_031104223037.txt dms_mobil_031112223038.txt dms_mobil_031105223042.txt dms_mobil_031109223043.txt dms_mobil_031110223040.txt dms_mobil_031113223038.txt dms_mobil_031114223041.txt dms_mobil_031115223040.txt dms_mobil_031116223040.txt dms_mobil_031117223040.txt -------------- sftptest-via-cron.log ------------------ Environment: _ = /usr/local/src/Meta/test/sftptest.pl HOSTTYPE = i386 HOME = /home/metaconn SHLVL = 1 OSTYPE = linux TERM = dumb PWD = /home/metaconn HOSTNAME = lx0042 MACHTYPE = i386-suse-linux LOGNAME = metaconn PATH = /usr/bin:/bin SHELL = /bin/sh Specials: $$ = 22796 $< = 500 $> = 500 $/ = $\ = <undef> $~ = STDOUT $% = 0 $= = 60 $- = 0 $, = <undef> $| = 0 $! = $? = 0 lx0042: Reading configuration data /home/metaconn/.ssh/config lx0042: Reading configuration data /etc/ssh_config lx0042: Connecting to sl00028.weimar.teagnetkom.de, port 22. lx0042: Remote protocol version 1.99, remote software version OpenSSH_3.5p1 lx0042: Net::SSH::Perl Version 1.24, protocol version 2.0. lx0042: No compat match: OpenSSH_3.5p1. lx0042: Connection established. lx0042: Sent key-exchange init (KEXINIT), wait response. lx0042: Algorithms, c->s: 3des-cbc hmac-sha1 none lx0042: Algorithms, s->c: 3des-cbc hmac-sha1 none lx0042: Entering Diffie-Hellman Group 1 key exchange. lx0042: Sent DH public key, waiting for reply. lx0042: Received host key, type 'ssh-dss'. lx0042: Host 'sl00028.weimar.teagnetkom.de' is known and matches the host key. lx0042: Computing shared secret key. lx0042: Verifying server signature. lx0042: Waiting for NEWKEYS message. lx0042: Enabling incoming encryption/MAC/compression. lx0042: Send NEWKEYS, enable outgoing encryption/MAC/compression. lx0042: Sending request for user-authentication service. lx0042: Service accepted: ssh-userauth. lx0042: Trying empty user-authentication request. lx0042: Authentication methods that can continue: publickey,password. lx0042: Next method to try is publickey. lx0042: Next method to try is password. lx0042: Trying password authentication. lx0042: Login completed, opening dummy shell channel. lx0042: channel 0: new [client-session] lx0042: Requesting channel_open for channel 0. lx0042: channel 0: open confirm rwindow 0 rmax 32768 lx0042: Got channel open confirmation, requesting shell. lx0042: Requesting service shell on channel 0. lx0042: channel 1: new [client-session] lx0042: Requesting channel_open for channel 1. lx0042: Sending subsystem: sftp lx0042: Requesting service subsystem on channel 1. lx0042: channel 1: open confirm rwindow 0 rmax 32768 lx0042: sftp: Sending SSH2_FXP_INIT Use of uninitialized value in numeric eq (==) at /usr/lib/perl5/site_perl/5.6.0/Net/SSH/Perl/SSH2.pm line 309. Connection closed at /usr/local/src/Meta/test/sftptest.pl line 31 -- Peter Marschall > is:energy GmbH Verzeichnisdienste http://www.is-energy.de |