Sponsored Content
Full Discussion: Perl ssh2 login issue.
Top Forums Shell Programming and Scripting Perl ssh2 login issue. Post 302480174 by mtomar on Tuesday 14th of December 2010 07:11:14 AM
Old 12-14-2010
Network Perl ssh2 login issue.

Hi Experts,

I came across this interesting situation. I have following ssh script login to multiple server. This works fine for one set of servers (linux) but on my sun boxes i am getting. error

Code:
#!/usr/bin/perl -w
use Net::SSH::Perl;
use POSIX;
use Term::ANSIColor qw(:constants);
use strict;

my @fwsrvip = ("10.0.0.21","10.0.0.23") ;
my %fwsrv = ("10.0.0.21","fw1","10.0.0.23","fw2") ;
my $hlckdate = strftime "%Y-%m-%d",localtime ;
my $user = "usr" ;
my $pass = "passwd";
my $cmd = "uname -a";

my $stdout;
my $stderr;
my $stdexit;

foreach (@fwsrvip) {
    my $ssh = Net::SSH::Perl->new($_,protocol =>'2',port =>22 ,debug => 1
    );

    $ssh->login($user, $pass);
    
    $ssh->register_handler("stdout",sub {my ($channel,$buffer) = @_; print $buffer->bytes;});

    print BOLD,"OS INFO: ", RESET;
    $ssh->cmd($cmd);

Code:
DUC302239: Reading configuration data /home/mtomar/.ssh/config
DUC302239: Reading configuration data /etc/ssh_config
DUC302239: Connecting to 10.254.225.21, port 22.
DUC302239: Remote protocol version 2.0, remote software version Sun_SSH_1.1
DUC302239: Net::SSH::Perl Version 1.34, protocol version 2.0.
DUC302239: No compat match: Sun_SSH_1.1.
DUC302239: Connection established.
DUC302239: Sent key-exchange init (KEXINIT), wait response.
DUC302239: Algorithms, c->s: 3des-cbc hmac-sha1 none
DUC302239: Algorithms, s->c: 3des-cbc hmac-sha1 none
DUC302239: Entering Diffie-Hellman Group 1 key exchange.
DUC302239: Sent DH public key, waiting for reply.
DUC302239: Received host key, type 'ssh-dss'.
DUC302239: Host '10.254.225.21' is known and matches the host key.
DUC302239: Computing shared secret key.
DUC302239: Verifying server signature.
DUC302239: Waiting for NEWKEYS message.
DUC302239: Send NEWKEYS.
DUC302239: Enabling encryption/MAC/compression.
DUC302239: Sending request for user-authentication service.
DUC302239: Service accepted: ssh-userauth.
DUC302239: Trying empty user-authentication request.
DUC302239: Authentication methods that can continue: gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive.
DUC302239: Next method to try is publickey.
Permission denied at ./fusion_hlcheck_ssh.pl line 22

if i enable interactive mode. It does ask for password once but rest of the script works fine.
Code:
my $ssh = Net::SSH::Perl->new($_,protocol =>'2',port =>22 ,debug => 1, interactive => 1
    );

has any one seen such behavior before ?
cheers !!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ssh2-keygen trust issue

I have two systems SysA & SysB having the same userid sharing the home directory via NFS mount. I need to know the steps to setup ssh trust between these two systems given that both share the home dir. I have tried all the steps to generate the keys & then creating identification &... (2 Replies)
Discussion started by: deo_kaustubh
2 Replies

2. Solaris

Login Issue

Hi, I am not able to login in the system as user.It is showing problem login as: User1 User1@10.xxx.xx.xx's password: Could not chdir to home directory /home/User1: No such file or directory Sun Microsystems Inc. SunOS 5.9 Generic May 2002 $ I have created the User1 and Its... (8 Replies)
Discussion started by: smartgupta
8 Replies

3. Solaris

login issue in solaris5.6

Hi, I have reset the account on solaris 5.6. After resetting, User unable to login and putty gets closed once enter the password. Please suggest ASAP..... Thanks in Advance (6 Replies)
Discussion started by: bpsunadm
6 Replies

4. Shell Programming and Scripting

perl ssh2 output formatting

Hi Experts, I am using following format for Perl SSH2 commands. #!/usr/bin/perl -w use Net::SSH::Perl; use POSIX; use Sys::Hostname; use Term::ANSIColor qw(:constants); use strict; #my $host="10.128.0.214"; my @nodeip = ("10.128.0.214","10.128.0.215") ; my %node =... (7 Replies)
Discussion started by: mtomar
7 Replies

5. Linux

Login issue

Hi, I have created one normal login id . When they have try to login then, They got error msg the permission denied. Please advice on this. Thanks, Mani (3 Replies)
Discussion started by: Mani_apr08
3 Replies

6. UNIX for Dummies Questions & Answers

sudo login issue

I logged in through ssh, but can't re-login as root. sudo login Arch login: root Password: Login incorrect Arch login: But I am sure my password is right. Why? But on local tty1, this works. (2 Replies)
Discussion started by: vistastar
2 Replies

7. Solaris

Login issue

Hello, I'm trying to setup my Solaris 10 servers to authenticate from a OpenLDAP server. I can get the Linux servers to authenticate from a OpenLDAP server, but not server the Solaris servers. Below I have posted some output so you can see my issue. <terminal output> -bash-3.00$ id... (5 Replies)
Discussion started by: bitlord
5 Replies

8. Red Hat

linux login issue

Dear all, When ever i login to linux box through putty , it is taking a long time to log in .....approx 2 min Kindly let me know any reason behind this.... (3 Replies)
Discussion started by: jegaraman
3 Replies

9. Shell Programming and Scripting

ssh2 foreach loop issue

Hello Everyone, I have the following codes that only works for the first login element. I can't get it work with the second and third login credentials. Can anyone here see the problem? I ran the code with host1, it works as expect. see below: # ./test.pl host1 Trying to connect... (3 Replies)
Discussion started by: tqlam
3 Replies

10. Red Hat

SSH login issue

Dear All , recently i have configured sftp for a user for which i have done chroot. but after this , sftp is working fine . but ssh is not working when we connect to the server. When we try to ssh <user>@<server ip> , the below is the error message that we get and not able to login. ... (2 Replies)
Discussion started by: jegaraman
2 Replies
SSH-KEYSIGN(8)						    BSD System Manager's Manual 					    SSH-KEYSIGN(8)

NAME
ssh-keysign -- ssh helper program for host-based authentication SYNOPSIS
ssh-keysign DESCRIPTION
ssh-keysign is used by ssh(1) to access the local host keys and generate the digital signature required during host-based authentication with SSH protocol version 2. ssh-keysign is disabled by default and can only be enabled in the global client configuration file /etc/ssh/ssh_config by setting EnableSSHKeysign to ``yes''. ssh-keysign is not intended to be invoked by the user, but from ssh(1). See ssh(1) and sshd(8) for more information about host-based authen- tication. FILES
/etc/ssh/ssh_config Controls whether ssh-keysign is enabled. /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_rsa_key These files contain the private parts of the host keys used to generate the digital signature. They should be owned by root, read- able only by root, and not accessible to others. Since they are readable only by root, ssh-keysign must be set-uid root if host- based authentication is used. Note that ssh-keysign is not set-uid by default on Mac OS X. /etc/ssh/ssh_host_dsa_key-cert.pub /etc/ssh/ssh_host_ecdsa_key-cert.pub /etc/ssh/ssh_host_rsa_key-cert.pub If these files exist they are assumed to contain public certificate information corresponding with the private keys above. SEE ALSO
ssh(1), ssh-keygen(1), ssh_config(5), sshd(8) HISTORY
ssh-keysign first appeared in OpenBSD 3.2. AUTHORS
Markus Friedl <markus@openbsd.org> BSD
August 31, 2010 BSD
All times are GMT -4. The time now is 02:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy