Pearl script Net::SFTP authentication error


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Pearl script Net::SFTP authentication error
# 1  
Old 01-09-2014
Pearl script Net::SFTP authentication error

Code:
#!/usr/local/bin/perl -w
use Net::SFTP;
use File::Copy;
 
my $user=(getpwuid($<))[0];
my $server = "servername";
print "user - $user  server - $server \n";
my %args = ( user => "$user", ssh_args => {port=> 'portnum'} );
$args{debug} = 1;
$args{user} = "user";
my $sftp=Net::SFTP->new($server, %args) or die "could not open connection to $server\n";

I am getting error
Code:
Reading configuration data /u/aa88254/.ssh/config
Reading configuration data /etc/ssh_config
Connecting to SERVER, port PORTNUM.
Remote protocol version 2.0, remote software version OpenSSH_5.3p1+sftpfilecontrol-v1.3-hpn13v5
Net::SSH::Perl Version 1.34, protocol version 2.0.
No compat match: OpenSSH_5.3p1+sftpfilecontrol-v1.3-hpn13v5.
Connection established.
Sent key-exchange init (KEXINIT), wait response.
Algorithms, c->s: 3des-cbc hmac-sha1 none
Algorithms, s->c: 3des-cbc hmac-sha1 none
Entering Diffie-Hellman Group 1 key exchange.
Sent DH public key, waiting for reply.
Received host key, type 'ssh-dss'.
Host 'SERVER' is known and matches the host key.
Computing shared secret key.
Verifying server signature.
Waiting for NEWKEYS message.
Send NEWKEYS.
Enabling encryption/MAC/compression.
Sending request for user-authentication service.
Service accepted: ssh-userauth.
Trying empty user-authentication request.
Authentication methods that can continue: publickey,password,keyboard-interactive.
Next method to try is publickey.
Trying pubkey authentication with key file '/u/aa88254/.ssh/id_dsa'
Authentication methods that can continue: publickey,password,keyboard-interactive.
Next method to try is publickey.
Next method to try is password.
Trying password authentication.
Will not query passphrase in batch mode.
Authentication methods that can continue: publickey,password,keyboard-interactive.
Next method to try is publickey.
Trying pubkey authentication with key file '/u/aa88254/.ssh/id_dsa'
Authentication methods that can continue: publickey,password,keyboard-interactive.
Next method to try is publickey.
Next method to try is password.
Trying password authentication.
Will not query passphrase in batch mode.
Authentication methods that can continue: publickey,password,keyboard-interactive.
Next method to try is publickey.
Trying pubkey authentication with key file '/u/aa88254/.ssh/id_dsa'
Received disconnect message: Too many authentication failures for user
at /data/pp42d1/software/perl-5.8.8/lib/5.8.8/Net/SSH/Perl/AuthMgr.pm line 143

for the same server when i had done sftp using command line its working properly
Code:
"sftp -o Port=PORTNUM user@server"

created public key RSA and stored in id_dsa and id_rsa, tried giving identify_file path to id_rsa, but same error i am getting.
I cannot use foreign or chilkat as library is not available, our production team is not ready to upgrade, i am using perl-5.8.8
please suggest any code changes for pearl script.

Last edited by vbe; 01-09-2014 at 09:13 AM.. Reason: more code tags...
# 2  
Old 01-10-2014
Since its especting a DSA key why not generate the proper ? pointless copying a a RSA for a DSA...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Web Development

Ssh authentication from .NET webpage to UNIX is not working

My .NET website invokes a perl script to perform GIT operations on Gerrit server running UBuntu. In the perl script I connect using passwordless authentication to Gerrit server as below: system ( "ssh gitadmin@gerritserver.com 'cd /xyz && git clone xxx' "); I verified that ssh authentication... (3 Replies)
Discussion started by: tkota
3 Replies

2. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

3. Red Hat

SFTP command with certificate authentication

Hello list, I am attempting to connect from a Redhat 6 machine to another linux machine. When I use the SSH command and specify my private key to use this it all connects fine, however there doesn't seem to be an option in the SFTP command to specify my private key for authentication. In... (2 Replies)
Discussion started by: landossa
2 Replies

4. Shell Programming and Scripting

passwordless authentication of SFTP script

Dear All I need to discuss about the problem which has been discussed so many times here. I need to transfer a file from server A to server B via passwordless SFTP script. By reading the threads on this topic here, I followed the below steps but still it's not working .. Pls find the steps... (13 Replies)
Discussion started by: uday.shankar
13 Replies

5. HP-UX

sftp/scp/ssh script with password as authentication

Hello, Do you guys know set of commands that can incorporate to sftp/scp/ssh to add password in a script to automate file transfer. Our client is not using ssh keys authentication so we are force to create a script to pass the password into the script to transfer files via sftp/scp/ssh. We... (4 Replies)
Discussion started by: james_falco
4 Replies

6. Shell Programming and Scripting

c function calling from a pearl script

Hi, Is it possible to call a c function defined in a .c file from a pearl script? How is this possible? Thannks in advance, JS (2 Replies)
Discussion started by: jisha
2 Replies

7. UNIX for Advanced & Expert Users

Pearl script to automate SSL certificate import

Hello, I want to automate the process of importing a SSL certificate name *.cer to cacerts through perl script. both the certificates belong to same folder. The usual way of doing it is by executing the below command which imports the key name certnew.cer to cacerts in the same folder. ... (4 Replies)
Discussion started by: m_kk
4 Replies

8. Shell Programming and Scripting

SFTP- Non-interactive user authentication

Hi All, sftp -b script.txt <hostname> user-authentication through non-interactive way is desired. But, its failing to do so. Could anyone kindly advise. Thanks for any/all help at the earliest. Regards, Dheeraj. (1 Reply)
Discussion started by: dheeruchakri
1 Replies

9. UNIX for Advanced & Expert Users

Pearl Script Help

#!/usr/bin/perl $basedir = "/home/MYUSERID/public_html/ordered_files"; $allowall = "yes"; $theext = ".gif"; use CGI; $onnum = 1; while ($onnum != 11) { my $req = new CGI; my $file = $req->param("FILE$onnum"); if ($file ne "") { my $fileName = $file; $fileName =~... (9 Replies)
Discussion started by: nikah_01
9 Replies
Login or Register to Ask a Question