Perl ssh2 login issue.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl ssh2 login issue.
# 1  
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 !!
# 2  
Old 12-14-2010
Just a wild guess: does this happen on the same box everytime? If so, check if that box might be configured to accept public-key authentication exclusively.
# 3  
Old 12-14-2010
Just a quick update. This is happening for all sun machines Sol 9 / 10 /8. I am checking public-key option.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question