pinnacle has asked for the wisdom of the Perl Monks concerning the following question:

I am getting "cipher" error while logging into linux box

#!/usr/bin/perl use Net::SSH::Perl; use Math::BigInt::GMP; use strict; use warnings; my $host = "xx.xx.xx.xx"; print "SSHing into $host...\n"; my $user = "xxxx"; my $passwd = "xxxxx"; my $cmd = "ls -l /root"; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user,$passwd); my ($output, $error, $exit) = $ssh->cmd($cmd); print $output;

Error Message

SSHing into xx.xx.xx.xx... No matching cipher found: client 3des-cbc,blowfish-cbc,arcfour server aes256-cbc at /usr/lib/perl5/vendor_perl/5.8.5/Net/SSH/Perl/SSH2.pm line 92

Replies are listed 'Best First'.
Re: Unable to ssh in linux box
by JavaFan (Canon) on May 18, 2011 at 00:50 UTC
    So, what happens if you manually ssh to said box? Does running it with one or more -v's reveal anything? Instead of outcommenting the Ciphers line on the server side, what happens if you set them to the same values? (Don't forget to restart the server).
Re: Unable to ssh in linux box
by Argel (Prior) on May 17, 2011 at 23:04 UTC
    The error message appears to be saying your client is trying: 3des-cbc, blowfish-cbc, and arcfour but the server is only using aes256-cbc. So you need to either modify the server to use e.g. 3des-cbc or modify your client to use aes256-cbc. If Net::SSH::Perl is shelling out to run ssh then check your ssh_config file (or sshd_config on the server).

    Elda Taluta; Sarks Sark; Ark Arks

      I already checked it

      On my server in file "/etc/ssh/sshd_config" I have setting like

      Ciphers aes256-cbc,3des-cbc,blowfish-cbc,arcfour

      On my client in file "/etc/ssh/ssh_config" I have setting like

      # Cipher 3des,aes128-cbc,3des-cbc,blowfish-cbc

      So on client it's commented out

      So if I comment out client and server cipher lines it still does not work

      Also I tried to login other server from same client I was able to login, in this case both client and server cipher setting is commented out

      Please Assist

        Have you tried copying the config file from the server to which you successfully logged in onto the server that failed the attempt ? Also, how do the versions of the servers compare ?

        JAT ...

        A user level that continues to overstate my experience :-))
Re: Unable to ssh in linux box
by salva (Canon) on May 18, 2011 at 08:34 UTC
    If you are able to connect to that host using the command line ssh client, then try using Net::OpenSSH instead of Net::SSH::Perl.

    Net::SSH2 may also be another good alternative.

Re: Unable to ssh in linux box
by Argel (Prior) on May 18, 2011 at 19:19 UTC
    I mentioned earlier to check the configs "If Net::SSH::Perl is shelling out". I just looked at Net::SSH::Perl and it's a pure Perl implementation (i.e. not shelling out). That means you need to tell it what ciphers to use (i.e. it is not using ssh_config).

    You might try running the server in debug mode (without forking) on a different port to get a better idea on what is going on. Seems like what your server is responding back with doesn't match the sshd_config file.

    Elda Taluta; Sarks Sark; Ark Arks