Re: [Ssh-sftp-perl-users] Error Handling / Log4Perl and Net::SFTP
Brought to you by:
dbrobins
From: Linke M. (K. 11) <mar...@cr...> - 2009-08-06 16:51:02
|
excellent, thank you. ________________________________ From: Russ Brewer [mailto:us...@gm...] Sent: Donnerstag, 6. August 2009 17:14 To: Linke Markus (KSTB 11) Cc: ssh...@li...; mar...@li... Subject: Re: [Ssh-sftp-perl-users] Error Handling / Log4Perl and Net::SFTP This is how I do it: my $sftp; eval { $sftp = Net::SFTP->new($sftpserver, user=>$sftpuser, debug=>1) }; if ($@) { print "Login problem on host $sftpserver for user $sftpuser\n"; print "ERROR = $@\n"; } else { print "Successful login for user $sftpuser on server $sftpserver\n"; } Best wishes, Russ On Thu, Aug 6, 2009 at 3:38 AM, Linke Markus (KSTB 11) <mar...@cr...> wrote: Hi, I'm trying to use Net::SFTP and log the warnings/errors via Log4Perl, but the script always dies when connecting: if ($debug =~ /VERBOSE/g) {$debug=1;} my $sftp = Net::SFTP->new($sftpserver, user=>$sftpuser, debug=>$debug) or $logger->logdie ("Cannot connect to $sftpserver as $sftpuser"); 2009-08-06 09:10:50 [sftp.pl:main] INFO> host name: xxx 2009-08-06 09:10:50 [sftp.pl:main] INFO> user name: xxx 2009-08-06 09:10:50 [sftp.pl:main] INFO> file name: xxx 2009-08-06 09:10:50 [sftp.pl:main] INFO> target directory: /xxx/ zus45a-5402: Reading configuration data /xxx/.ssh/config zus45a-5402: Reading configuration data /etc/ssh_config zus45a-5402: Connecting to xxx, port 22. [...] zus45a-5402: Trying pubkey authentication with key file '/xxx/id_dsa' Received disconnect message: Too many authentication failures for xxx at /app/CMpkg2/perl_588/lib/site_perl/5.8.8/Net/SSH/Perl/AuthMgr.pm line 142 Is it possible to get the error back from the Net::SFTP->new call? Thanks, Markus ------------------------------------------------------------------------ ------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |