Selected cipher type not supported by server

  • Thread starter lovecreatesbea...
  • Start date

L

lovecreatesbea...

Hi,

I'm getting "Selected cipher type not supported by server" error on
this line

$cnn = Net::SSH::perl->new($host);

The error occurs even when I specify all IDEA, DES, DES3, Blowfish,
arcfour, blowfish-cbc, and 3des-cbc like this:

$cnn = Net::SSH::perl->new($host, cipher => "IDEA");

in the following script. How can I correct this?


Thank you for your time.



#!/usr/bin/perl

use Net::SSH::perl;
my ($host, $user, $pass, $mgrip, $rpwd, $prmpt, $tmout, $line);
$host = $ARGV[0];
$user = $ARGV[1];
$pass = $ARGV[2];
$mgrip = $ARGV[3];
$rpwd = $ARGV[4];
$prmpt = '/[\$%#>] ?$/';
$tmout = 2;

$cnn = Net::SSH::perl->new($host);
$cnn->login($user, $pass);
#$cnn->print("/bin/su -");
#$cnn->waitfor('/password: ?$/i');
#$cnn->print($rpwd);
#$cnn->prompt('/# $/');
#$cnn->waitfor($cnn->prompt);
#@line = $cnn->cmd("/usr/sbin/dasnmp -a $mgrip");
@line = $cnn->cmd("ls /");
print "@line\n";
 
Ad

Advertisements

L

lovecreatesbea...

Hi,

I'm getting "Selected cipher type  not supported by server" error on
this line

    $cnn = Net::SSH::perl->new($host);

The error occurs even when I specify all IDEA, DES, DES3, Blowfish,
arcfour, blowfish-cbc, and 3des-cbc like this:

    $cnn = Net::SSH::perl->new($host, cipher => "IDEA");

in the following script. How can I correct this?

Thank you for your time.

#!/usr/bin/perl

use Net::SSH::perl;
my ($host, $user, $pass, $mgrip, $rpwd, $prmpt, $tmout, $line);
$host   = $ARGV[0];
$user   = $ARGV[1];
$pass   = $ARGV[2];
$mgrip  = $ARGV[3];
$rpwd   = $ARGV[4];
$prmpt  = '/[\$%#>] ?$/';
$tmout  = 2;

$cnn = Net::SSH::perl->new($host);
$cnn->login($user, $pass);
#$cnn->print("/bin/su -");
#$cnn->waitfor('/password: ?$/i');
#$cnn->print($rpwd);
#$cnn->prompt('/# $/');
#$cnn->waitfor($cnn->prompt);
#@line = $cnn->cmd("/usr/sbin/dasnmp -a $mgrip");
@line = $cnn->cmd("ls /");
print "@line\n";

And these commented lines,

#$cnn->print("/bin/su -");
#$cnn->waitfor('/password: ?$/i');
#$cnn->print($rpwd);
#$cnn->prompt('/# $/');
#$cnn->waitfor($cnn->prompt);
#@line = $cnn->cmd("/usr/sbin/dasnmp -a $mgrip");

I used them to perform su root when the cnn was an telnet connection.
The print, waitfor and prompt come from telnet can not be used in ssh
connection in my code.

How can I su root in ssh connection?
 
D

Dr.Ruud

(e-mail address removed) schreef:
#!/usr/bin/perl

Missing:
use strict;
use warnings;

use Net::SSH::perl;
my ($host, $user, $pass, $mgrip, $rpwd, $prmpt, $tmout, $line);
$host = $ARGV[0];
$user = $ARGV[1];
$pass = $ARGV[2];
$mgrip = $ARGV[3];
$rpwd = $ARGV[4];
$prmpt = '/[\$%#>] ?$/';
$tmout = 2;

You can write that as:

my ($host, $user, $pass, $mgrip, $rpwd) = @ARGV;
my $prmpt = qr/[\$%#>] ?$/;
my $tmout = 2;

I don't see $prmpt nor $line used anywhere.
 
L

lovecreatesbea...

Are you tring to connect to an SSH-1 or SSH-2 host?
If not sure, report the error(s) you get from trying each.

Hi, Thank you.

I tried the following ciphers one by one and got the same error
message: "Selected cipher type not supported by server Options ".


I manually ssh login the host and check the version. Is OpenSSH_4.6p1
an SSH1 or SSH2 implementation, or both?

[email protected]:/etc/ssh# ssh -V
OpenSSH_4.6p1, OpenSSL 0.9.8d 28 Sep 2006
[email protected]:/etc/ssh#

root user ssh login is enabled defaultly, right? So I don't su root,
do I?

The Cipher lines in ssh_config file are commented out as following.
How can know its cipher settings?

[email protected]:/etc/ssh# grep Cipher ssh_config
# Cipher 3des
# Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-
cbc,arcfour,aes192-cbc,aes256-cbc
[email protected]:/etc/ssh#

[ Do I need to in my perl script issue "ssh -c <cipher_spec>" command
before ...? Absolutely not! I am not ssh-connected with the host. What
can I do? ]
 
Ad

Advertisements

L

lovecreatesbea...

The rule when you don't know what's wrong is to step back to the
earliest place that you get an error.

Most ssh supports protocol type 1 and 2 these days, but to narrow
down your problem, try each each individually. Let the cipher type
be the default for that protocol. So try each of these separately:

$cnn = Net::SSH::perl->new($host, -protocol => '1');

$cnn = Net::SSH::perl->new($host, -protocol => '2');

You may get a different error from each one which would be a clue
for what's wrong.

Hi, thank you very much. When I specified protocol => '2' explicitly,
I was prompted with the message of missing perl modules:

my $ssh = Net::SSH::perl->new("192.168.50.50", protocol => '2');
$ssh->login($user, $pass);
$ssh->cmd("hostname");
### Can't locate Math/Pari.pm in @INC

When I used `protocol=>'1' or didn't specify that parameter then I got
"Selected cipher type not supported by server Options". I downloaded
those from cpan and had them installed. Now it works.

Before I tried this successfully, I ever went to except script but
failed at last. So, thank you very much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top