Net-SSH-Perl - Connect to host using DSA authentication

Posted on Wed Nov 7 16:04:51 2007 by sondahl
Connect to host using DSA authentication
I'm trying to connect to a host using DSA authentication. See below:

############################################## #!/usr/bin/perl -w use strict; use Net::SSH::Perl; my $host = "XXX.XXX.XXX.XXX"; my $username = "root"; my $rcmd = "mkdir /testecomC"; my $file = "/etc/id_dsa"; my %params = ( debug => 1, identity_files => [$file], protocol=>'2,1', ); my $ssh = Net::SSH::Perl->new($host, %params); $ssh->login($username); $ssh->cmd($rcmd); ##############################################

Shell output:

Reading configuration data /home/USER/.ssh/config Reading configuration data /etc/ssh_config Connecting to XXX.XXX.XXX.XXX, port 22. Remote version string: SSH-1.99-OpenSSH_3.6.1p2 Remote protocol version 1.99, remote software version OpenSSH_3.6.1p2 Net::SSH::Perl Version 1.30, protocol version 2.0. No compat match: OpenSSH_3.6.1p2. 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 'XXX.XXX.XXX.XXX' is known and matches the host key.
Computing shared secret key. Verifying server signature. Waiting for NEWKEYS message. Enabling incoming encryption/MAC/compression. Send NEWKEYS, enable outgoing 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 '/etc/id_dsa' Will not query passphrase for '/etc/id_dsa' in batch mode. Loading private key failed. 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 '/etc/id_dsa' Will not query passphrase for '/etc/id_dsa' in batch mode. Loading private key failed. 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 '/etc/id_dsa' Will not query passphrase for '/etc/id_dsa' in batch mode. Loading private key failed. 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 '/etc/id_dsa' Will not query passphrase for '/etc/id_dsa' in batch mode. Loading private key failed. Next method to try is password. Permission denied at ./mkdir.pl line 20
Write a response