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.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT DEBIAN
net::openssh::compat::perl
Net::OpenSSH::Compat::Perl(3pm) User Contributed Perl Documentation Net::OpenSSH::Compat::Perl(3pm)NAME
Net::OpenSSH::Compat::Perl - Net::OpenSSH adapter for Net::SSH::Perl API compatibility
SYNOPSIS
use Net::OpenSSH::Compat::Perl qw(:supplant);
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new('host');
$ssh->login($user, $passwd);
my ($out, $err, $rc) = $ssh->cmd($cmd);
DESCRIPTION
This module implements a subset of Net::SSH::Perl API on top of Net::OpenSSH.
After the module is loaded as...
use Net::OpenSSH::Compat::Perl qw(:supplant);
... it supplants the Net::SSH::Perl module as if it were installed on the machine using Net::OpenSSH under the hood to handle SSH
operations.
Setting defaults
The hash %Net::OpenSSH::Compat::Perl::DEFAULTS can be used to set default values for Net::OpenSSH and other modules called under the hood
and otherwise not accesible through the Net::SSH::Perl API.
The entries currently supported are:
connection => [ %opts ]
Extra options passed to "Net::OpenSSH::new" constructor.
Example:
$Net::OpenSSH::Compat::SSH::Perl::DEFAULTS{connection} =
[ ssh_path => "/opt/SSH/bin/ssh" ];
BUGS AND SUPPORT
This is a work in progress.
"register_handler" method is not supported.
Net::SSH::Perl submodules (i.e. Net::SSH::Perl::Channel) are not emulated.
Anyway, if your Net::SSH::Perl script fails, fill a bug report at the CPAN RT bugtracker
(https://rt.cpan.org/Ticket/Create.html?Queue=Net-OpenSSH-Compat <https://rt.cpan.org/Ticket/Create.html?Queue=Net-OpenSSH-Compat>) or just
send me an e-mail with the details.
Include at least:
1 - The full source of the script
2 - A description of what happens in your machine
3 - What you thing it should be happening
4 - What happens when you use the real Net::SSH::Perl
5 - The version and name of your operating system
6 - The version of the OpenSSH ssh client installed on your machine ("ssh -V")
7 - The Perl version ("perl -V")
8 - The versions of the Perl packages Net::OpenSSH, IO::Pty and this Net::OpenSSH::Compat.
Git repository
The source code repository is at https://github.com/salva/p5-Net-OpenSSH-Compat <https://github.com/salva/p5-Net-OpenSSH-Compat>.
My wishlist
If you like this module and you're feeling generous, take a look at my Amazon Wish List: <http://amzn.com/w/1WU1P6IR5QZ42>
Also consider contributing to the OpenSSH project this module builds upon: <http://www.openssh.org/donations.html>.
COPYRIGHT AND LICENSE
Copyright (C) 2011 by Salvador Fandin~o (sfandino@yahoo.com)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.
perl v5.14.2 2012-02-24 Net::OpenSSH::Compat::Perl(3pm)