ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 36)
Brought to you by:
dbrobins
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(4) |
Feb
(15) |
Mar
(13) |
Apr
(8) |
May
(5) |
Jun
(21) |
Jul
(4) |
Aug
(9) |
Sep
(11) |
Oct
(14) |
Nov
(15) |
Dec
(24) |
| 2005 |
Jan
(10) |
Feb
(20) |
Mar
(16) |
Apr
(10) |
May
(12) |
Jun
(16) |
Jul
(18) |
Aug
(21) |
Sep
(11) |
Oct
(19) |
Nov
(16) |
Dec
(9) |
| 2006 |
Jan
(17) |
Feb
(32) |
Mar
(60) |
Apr
(21) |
May
(24) |
Jun
(1) |
Jul
(6) |
Aug
(18) |
Sep
(4) |
Oct
(9) |
Nov
(31) |
Dec
(10) |
| 2007 |
Jan
(8) |
Feb
(11) |
Mar
(3) |
Apr
(7) |
May
(4) |
Jun
(6) |
Jul
(7) |
Aug
(3) |
Sep
(2) |
Oct
(5) |
Nov
(5) |
Dec
(5) |
| 2008 |
Jan
(12) |
Feb
(5) |
Mar
(7) |
Apr
(4) |
May
(37) |
Jun
(9) |
Jul
(24) |
Aug
(5) |
Sep
(2) |
Oct
(7) |
Nov
(6) |
Dec
(7) |
| 2009 |
Jan
(18) |
Feb
(9) |
Mar
(14) |
Apr
(14) |
May
(1) |
Jun
(14) |
Jul
(4) |
Aug
(6) |
Sep
(4) |
Oct
(12) |
Nov
(4) |
Dec
|
| 2010 |
Jan
|
Feb
(3) |
Mar
|
Apr
(1) |
May
(4) |
Jun
|
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(7) |
Nov
(2) |
Dec
(5) |
| 2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(8) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
|
Oct
(4) |
Nov
(9) |
Dec
(7) |
| 2012 |
Jan
(1) |
Feb
(19) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
(6) |
Dec
|
| 2014 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Olivier A. <ol...@au...> - 2004-07-29 08:58:58
|
hi
I dont' know how to know if my password is correct when I'm connecting
on ssh.
I'have read the error handle that someone have post here but that don't
work for me. I have try this :
foreach $host (@ip) {
print $host."\n";
$ssh = Net::SSH::Perl->new($host);
eval { $ret = $ssh->login($user, $pass);};
print "LOG2 : ".$ret."\n";
}
but the ret value show me the password when i can login and when i can't
login.
can anyone help me
thx
Olivier AUDRY
ps : sorry for my english i'm not an english speaker
|
|
From: Hudson, C. <Chr...@bs...> - 2004-07-29 08:05:49
|
I'm not sure of the exact solution to this, but I can give you a pointer. It is something to do with the version of the include file fcntl.h it finds when it compiles the package as you install it. Check your INCLUDE path and all versions of fcntl.h that you have. I found that with visual c++ 6.0 installed that it was compiling against a subset of the full UNIX fcntl.h #defines. I may have fixed it using gnu c++ to get this file, or maybe it was in the platform SDK or DDK... not sure. Hope this helps. Chris -----Original Message----- From: ssh...@li... [mailto:ssh...@li...] On Behalf Of Michael Ragsdale Sent: 28 July 2004 15:36 To: ssh...@li... Subject: [Ssh-sftp-perl-users] sftp in windows environment I'm trying to convert all of my scripts from Net-FTP over to Net-SFTP on ActiveState 5.6.1 and I'm having some difficulty. I installed Net-SFTP successfully and had a port mapping issue. I edited the winnt/system32/drivers/etc/services file and fixed that issue by adding ssh 22/tcp to the file. Then I received the following error message: Your vendor has not defined Fcntl macro F_SETFL, used at H:/Perl/site/lib/Net/SSH/Perl.pm line 214. After some research, I found that I need to install Net-SSH-W32Perl that is supposed to contain a workaround. I've installed it successfully, but I'm not sure how to force Net-SFTP to use that module as opposed to the Net-SSH-Perl module. I'm still getting the same error message. After some more googling, I edited the /Perl/site/lib/Net/SSH/Perl.pm file and commented out the call to fcntl and now I'm getting the following error: Key class 'Net::SSH::Perl::Key::DSA' is unsupported: Can't locate Crypt/DSA.pm in @INC (@INC contains: lib D:/Perl/lib D:/Perl/site/lib .) at D:/Perl/site/lib/Net/SSH/Perl/Key/DSA.pm line 14, <GEN0> line 1. BEGIN failed--compilation aborted at D:/Perl/site/lib/Net/SSH/Perl/Key/DSA.pm line 14, <GEN0> line 1. Compilation failed in require at (eval 36) line 1, <GEN0> line 1. BEGIN failed--compilation aborted at (eval 36) line 1, <GEN0> line 1. When I search, I cannot find anything regarding this key class error. Does anyone have any sample code for appending files using Net-SFTP in a Windows environment or have a workaround for this? -Mike ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users . ----------------------------------------------------------------------- Information in this email may be privileged, confidential and is intended exclusively for the addressee. The views expressed may not be official policy, but the personal views of the originator. If you have received it in error, please notify the sender by return e-mail and delete it from your system. You should not reproduce, distribute, store, retransmit, use or disclose its contents to anyone. Please note we reserve the right to monitor all e-mail communication through our internal and external networks. ----------------------------------------------------------------------- |
|
From: Michael R. <mra...@ut...> - 2004-07-28 14:37:31
|
I'm trying to convert all of my scripts from Net-FTP over to Net-SFTP on ActiveState 5.6.1 and I'm having some difficulty. I installed Net-SFTP successfully and had a port mapping issue. I edited the winnt/system32/drivers/etc/services file and fixed that issue by adding ssh 22/tcp to the file. Then I received the following error message: Your vendor has not defined Fcntl macro F_SETFL, used at H:/Perl/site/lib/Net/SSH/Perl.pm line 214. After some research, I found that I need to install Net-SSH-W32Perl that is supposed to contain a workaround. I've installed it successfully, but I'm not sure how to force Net-SFTP to use that module as opposed to the Net-SSH-Perl module. I'm still getting the same error message. After some more googling, I edited the /Perl/site/lib/Net/SSH/Perl.pm file and commented out the call to fcntl and now I'm getting the following error: Key class 'Net::SSH::Perl::Key::DSA' is unsupported: Can't locate Crypt/DSA.pm in @INC (@INC contains: lib D:/Perl/lib D:/Perl/site/lib .) at D:/Perl/site/lib/Net/SSH/Perl/Key/DSA.pm line 14, <GEN0> line 1. BEGIN failed--compilation aborted at D:/Perl/site/lib/Net/SSH/Perl/Key/DSA.pm line 14, <GEN0> line 1. Compilation failed in require at (eval 36) line 1, <GEN0> line 1. BEGIN failed--compilation aborted at (eval 36) line 1, <GEN0> line 1. When I search, I cannot find anything regarding this key class error. Does anyone have any sample code for appending files using Net-SFTP in a Windows environment or have a workaround for this? -Mike |
|
From: Chris L. <cp...@st...> - 2004-07-23 07:23:12
|
The following snippet of code works fine if I set it loose
on localhost (openssh on linux):
use Net::SFTP;
use Data::Dump qw(dump);
my %args = (ssh_args => []);
$args{user} = $user;
$args{password} = $pass;
$args{debug} = 1;
#push @{ $args{ssh_args} }, protocol => 2;
my $sftp = Net::SFTP->new($host,%args); # line 13
dump $sftp->ls(".");
But if I take aim at a remote SFTP server (cygwin/openssh
on windows server 2003), the code above always dies in the
same way:
myhost: Login completed, opening dummy shell channel.
myhost: channel 0: new [client-session]
myhost: Requesting channel_open for channel 0.
myhost: channel 0: open confirm rwindow 0 rmax 32768
myhost: Got channel open confirmation, requesting shell.
myhost: Requesting service shell on channel 0.
myhost: channel 1: new [client-session]
myhost: Requesting channel_open for channel 1.
myhost: Sending subsystem: sftp
myhost: Requesting service subsystem on channel 1.
myhost: channel 1: open confirm rwindow 0 rmax 32768
myhost: sftp: Sending SSH2_FXP_INIT
myhost: channel 1: rcvd eof
myhost: channel 1: output open -> drain
myhost: channel 1: rcvd close
myhost: channel 1: input open -> closed
myhost: channel 1: close_read
myhost: channel 1: obuf empty
myhost: channel 1: output drain -> closed
myhost: channel 1: close_write
myhost: channel 1: send close
myhost: channel 1: full closed
Connection closed at ./test.pl line 13
Logging in using the command line 'sftp' utility works fine when
accessing the same remote windows server 2003 server (the one
connection remains stable for hours), so I'm at a bit of a loose end.
One thing I noticed when using the sftp utility though is that all
communications stay on channel 0.
I went thru the OpenBSD ssh_config (5) manpage looking for options
to disable channel 1 usage but came up blank.
Any tips?
Regards
Chris Langlands
|
|
From: Nguyen, D. M <dav...@xo...> - 2004-06-30 16:29:44
|
I write a script to login unix system then attempt to change to ROOT but
the script does not work with "su" command. Does someone know what I am
doing wrong with my script?
=20
=20
use Net::SSH::Perl;
=20
$ssh =3D Net::SSH::Perl->new("systemONE");
$ssh->login("userid", "password");
=20
$cmd1 =3D "su -"; =20
($out1) =3D $ssh->cmd("$cmd1");
print "$out1\n";
=20
$cmd2 =3D "ROOTpassword";
($out2) =3D $ssh->cmd("$cmd2");
print "$out2\n";
=20
$cmd3 =3D "id";
($out3) =3D $ssh->cmd("$cmd3");
print "$out3\n";
=20
$ssh->cmd("exit");
$ssh->cmd("exit");
=20
=20
=20
|
|
From: LOYER I. - R. <isa...@at...> - 2004-06-28 16:41:53
|
Hello,
I use the "Net::SSH:Perl 1.25" module to connect to a host and execute
an interactive command.
For that, I use register_handler like this :
$session->register_handler("stdout", sub {
my($channel, $buffer) = @_;
my $str = $buffer->bytes;
if ($str eq "Protocol[ip]:") {
$channel->send_data("ip"."\n");
}
elsif ($str eq "Repeat count[5]:") {
$channel->send_data($repeat."\n");
}
elsif ($str eq "Sweep range of sizes[n]:") {
$channel->send_data("n"."\n");
}
});
my($out, $err)=('','');
($out, $err) = $session->cmd($command);
print $err;
But, the problem is the buffer I received is not exactly what I am
testing.
I would like to use a fonction to search a string in the buffer (like
index).
Is it possible???
I have also an error on the last line "Use of uninitialized value in
print".
I thought I had initialized $err with the line :
my($out, $err)=('','');
What am I doing wrong???
Thanks in advance.
|
|
From: Dave R. <au...@ur...> - 2004-06-23 17:32:15
|
On Wed, 23 Jun 2004, Dave Rolsky wrote: > On Wed, 23 Jun 2004, Mike Diehl (Encrypted email preferred) wrote: > > > I know that the show clock command is valid on the destination server. So, > > what am I doing wrong? > > Is this a shell command? I don't think those work, only actual binaries. s/binaries/executables/; -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: Dave R. <au...@ur...> - 2004-06-23 17:32:07
|
On Wed, 23 Jun 2004, Mike Diehl (Encrypted email preferred) wrote: > I know that the show clock command is valid on the destination server. So, > what am I doing wrong? Is this a shell command? I don't think those work, only actual binaries. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: Mike D. (E. e. preferred) <md...@di...> - 2004-06-23 17:26:43
|
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I've got a (very short) program that I'm trying to get working with the=20
Net::SSH::Perl module.
All it does is connects to a host, issues a command and prints the results.
The device in question is a Foundry Switch.
=2D -------------------------------------------------------------------
#!/usr/bin/perl
use Net::SSH::Perl;
$params{debug} =3D 1;
$ssh =3D Net::SSH::Perl->new("safn2001", %params);
$ssh->login("username", "password");
($out, $err, $exit) =3D $ssh->cmd("show clock");
print "X: $err, $exit\n";
print $out;
=2D -------------------------------------------------------------------
When I run it, I get:
=2D -------------------------------------------------------------------
mapping.sandia.gov: Reading configuration data /root/.ssh/config
mapping.sandia.gov: Reading configuration data /etc/ssh_config
mapping.sandia.gov: Allocated local port 1023.
mapping.sandia.gov: Connecting to safn2001, port 22.
mapping.sandia.gov: Remote protocol version 1.5, remote software version
1.2.27
mapping.sandia.gov: Net::SSH::Perl Version 1.25, protocol version 1.5.
mapping.sandia.gov: No compat match: 1.2.27.
mapping.sandia.gov: Connection established.
mapping.sandia.gov: Waiting for server public key.
mapping.sandia.gov: Received server public key (768 bits) and host key (1024
bits).
mapping.sandia.gov: Host 'safn2001' is known and matches the host key.
mapping.sandia.gov: Encryption type: IDEA
mapping.sandia.gov: Sent encrypted session key.
mapping.sandia.gov: Received encryption confirmation.
mapping.sandia.gov: Remote: Server does not permit empty password login.
mapping.sandia.gov: RSA authentication failed: Can't load public key.
mapping.sandia.gov: Trying password authentication.
mapping.sandia.gov: Sending command: show clock
mapping.sandia.gov: Entering interactive session.
Received disconnect message: Illegel commands
at /usr/lib/perl5/site_perl/5.8.0/Net/SSH/Perl/SSH1.pm line 369
=2D -------------------------------------------------------------------
I know that the show clock command is valid on the destination server. So,
what am I doing wrong?
Thanx in advance,
=2D --=20
Mike
gpg key: http://diehlnet.com/~mdiehl/mdiehl.asc
83AD D927 758D 4BFC A800 0277 4B26 75A4 F0D1 C7EB
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA2b8ASyZ1pPDRx+sRAoPPAJ0S6xNFgRgvIMvlVqJrl8E7l5WBvQCgxiUg
Q2x8MWXv1zxApOuOHDIu7yU=3D
=3D10hM
=2D----END PGP SIGNATURE-----
|
|
From: Isaacson T. <Tra...@HC...> - 2004-06-16 16:25:39
|
I am having transfer speed issues with NET::SFTP, via the following script
(which I copied from a google search):
----------------------------------------------------------------------------
--------------------
#!/usr/bin/perl
use strict;
use Net::SFTP;
# Net::SFTP does no error reporting
my $sftp = undef;
#eval{
$sftp = Net::SFTP->new("host",
user=>"loginID",
password=>"password",
);
#};
if ($@) { print "Sftp connection failed:\n $@\n"; }
if (! $sftp) {
print "I can't connect!\n";
}else{
print "SUCCESS!\n";
}
system('date');
print "getting file . . .\n";
$sftp->get ("sftptestdata", "sftptestdata");
system('date');
----------------------------------------------------------------------------
-------------------
I only get 10-->kb<--/sec with the above script. command line sftp and ftp
provide something around ~3mb/sec. so far I have been unable to locate a
solution via the mighty google. has anyone ran across this issue?
thanks.
Trace
|
|
From: Dave R. <au...@ur...> - 2004-06-08 16:38:40
|
On Tue, 8 Jun 2004, Nguyen, David M wrote: > I have a short script using Net::SSH::Perl module. I receive following > errors when running the script. I complains about Math::GMP module not > found. Where can I find that module to download/install? It's on CPAN, like all Perl modules. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: Nguyen, D. M <dav...@xo...> - 2004-06-08 15:41:51
|
=20 =20 I have a short script using Net::SSH::Perl module. I receive following errors when running the script. I complains about Math::GMP module not found. Where can I find that module to download/install? =20 =20 $ SSH.pl =20 Can't locate loadable object for module Math::GMP in @INC (@INC contains: /usr/l ocal/lib/perl5/5.6.0/sun4-solaris /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl 5/site_perl/5.6.0/sun4-solaris /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/l ib/perl5/site_perl .) at /usr/local/lib/perl5/site_perl/5.6.0/Net/SSH/Perl/Util/ SSH1MP.pm line 7 Compilation failed in require at /usr/local/lib/perl5/site_perl/5.6.0/Net/SSH/Pe rl/Util/SSH1MP.pm line 7, <GEN0> line 1. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.6.0/Net/SS H/Perl/Util/SSH1MP.pm line 7, <GEN0> line 1. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.6.0/Net/SSH/Pe rl/Util.pm line 56, <GEN0> line 1. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.6.0/Net/SS H/Perl/Key/RSA1.pm line 6, <GEN0> line 1. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.6.0/Net/SSH/Pe rl/SSH1.pm line 13, <GEN0> line 1. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.6.0/Net/SS H/Perl/SSH1.pm line 13, <GEN0> line 1. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.6.0/Net/SSH/Pe rl.pm line 51, <GEN0> line 1. =20 Thanks, David |
|
From: Kamal <ks...@en...> - 2004-06-04 06:05:17
|
The Net::SSH::Perl module has by default the Die mode and if any error = occur while establishing SSH connection,it terminates the program and = comes out of the program.Can anyone write a script which will change the = mode and rather than terminating the program it returns with some = parameter which can be used to determine that SSH connection broke.I = have a constarint that I cant change the perl module ...Soby using the = default module can I change the "die" mode for my script. |
|
From: John F. <joh...@zn...> - 2004-06-04 00:48:13
|
FYI
Answer-
How to use Net::SSH::Perl to run chrooted commands on remote server.
Rules:
1) you have to login as root, not the user
2) with each command you must run chroot as part of the command <see
example> to get a command running inside the chroot enviro
3) you must use absolute pathnames, even for well-known commands
4) you still have to be careful about the environment and shell - it
doesn't act like a normal bash shell you reach manually
Code snippet:
use strict;
use diagnostics;
use Net::SSH::Perl;
my $cmd = "/usr/sbin/chroot /home/username/buildenv/potato myscript
param param param" ;
# myscript runs with the potato directory as its root
my $ssh = Net::SSH::Perl->new($host, debug => 10, protocol => 2);
# using code from instructions...
$ssh->login($user, $pass);
my($out, $err, $exit) = $ssh->cmd($cmd);
print("\n " . $out1 ) if $out1;
Why would anyone want to do this?
I build multiple large images on a remote Linux server nightly. I wrote
a script to extract them from cvs, and build in a special build
environment. ( the server runs a different Linux from the builds)
I version control the build environment itself, so that various releases
are tied to a controlled version of Linux. Each developer and I get to
choose which environment we build in, depending on which release we are
working on, latest or bug fixes. Sometimes I have to tarball the whole
build enviro and give it to a customer, too. We used to keep removable
hard drives for each flavor, but now we use multiple chroot environments
on a bigger server.
thanks
John
----------------------------------------------------
John P. Fisher
at ZNYX Networks
805 683 1488 x 3245
joh...@zn...
|
|
From: Dave R. <au...@ur...> - 2004-06-03 22:04:46
|
On Thu, 3 Jun 2004, Shapiro, David wrote: > Thanks for pointing me in the right direction.. I did a search on > identity_files and Net::SSH:Perl and found a journal article with an > example. It lookslike PreferredAuthentications option helped out. The Where was the article? -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: John F. <joh...@zn...> - 2004-06-03 17:01:40
|
> >Message: 4 >Date: Wed, 02 Jun 2004 16:09:11 -0700 >From: John Fisher <joh...@zn...> > >I am trying to use the package to log into a server which uses chroot >environments. As a person if I 'ssh -l username servername' >I get dropped into the chroot environment. > <snip> Hold the phone- after some thought ( what a concept!) I looked at the man pages again and tried running a command instead of a session login over a manual ssh connection. ssh -l <name> <server> "ls -l /builds" failed in the same general way as Net::SSH. So, I am back to looking at SSH and sudo - thanks for the help. John |
|
From: Shapiro, D. <dav...@it...> - 2004-06-03 13:17:29
|
This is probably a simple one for those who know this stuff. I am trying to
do something real simple as a test. Basically, I want to run
/usr/local/bin/sudo /usr/sbin/format c1t0d0 and when it sees the format>
prompt I want it to exit. I tried to use the register_handler, but it
pauses. I end up typing "quit" myself to get it to exit. It displays the
$str content, but $out does not show anything. I was expecting the handler
to see format> and type quit for me, but it does not do it. I tried
interactive => 0 in new, but that did not work. I tried setting handler to
look at stderr just in case format stuff went to that handle instead of
stdout like the passwd example, but that did did not work either.
#!/usr/local/bin/perl
use Net::SSH::Perl;
use Net::SSH::Perl::Constants qw( :msg2 );
my $ssh = Net::SSH::Perl->new(
"falcon",
debug => 1,
protocol => 2,
options => [
"RhostsRSAAuthentication yes",
"HostbasedAuthentication yes",
#"UsePrivilegedPort yes",
"PreferredAuthentications
publickey,hostbased,password,keyboard-interactive",
"EnableSSHKeysign yes"
]
);
$ssh->login("nagios");
$ssh->register_handler("stdout", sub {
my($channel, $buffer) = @_;
my $str = $buffer->bytes;
print "string: $str\n";
if ($str =~ /format>/) {
$channel->send_data("quit\r");
}
});
my ($out,$err,$rc) = $ssh->cmd("/usr/local/bin/sudo /usr/sbin/format
c1t0d0");
print "out: $out\n";
print "err: $err\n";
|
|
From: Shapiro, D. <dav...@it...> - 2004-06-03 12:43:57
|
Thanks for pointing me in the right direction.. I did a search on
identity_files and Net::SSH:Perl and found a journal article with an
example. It lookslike PreferredAuthentications option helped out. The
final code example is as follows:
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new(
"falcon",
options => [
"RhostsRSAAuthentication yes",
"HostbasedAuthentication yes",
#"UsePrivilegedPort yes",
"PreferredAuthentications
publickey,hostbased,password,keyboard-interactive",
"EnableSSHKeysign yes"
]
);
$ssh->login("nagios");
my ($out,$err,$rc) = $ssh->cmd("ls -la");
print "out: $out\n";
-----Original Message-----
From: Dave Rolsky [mailto:au...@ur...]
Sent: Wednesday, June 02, 2004 5:57 PM
To: Shapiro, David
Cc: 'ssh...@li...'
Subject: Re: [Ssh-sftp-perl-users] ssh with public keys?
On Wed, 2 Jun 2004, Shapiro, David wrote:
> Is there a way to have Net::SSH::Perl run using the public key with no
> passphrase I set up?
>
> i tried commenting out login, but that did not work. I tried just
> using $ssh->login($user), but that fails too. Is there some way I
> have to set up the new object to allow me to use public key/no passphrase
logins?
Check out the identity_files option which can be passed to the new() method.
I think that will do what you want.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/
|
|
From: John F. <joh...@zn...> - 2004-06-03 00:16:38
|
These worked, and the shell is bash... my $cmd1 = "man ls " ; my $cmd2 = "echo " . '$SHELL' ; my $cmd3 = "cat /tmp/autobuild.log" ; my $cmd1 = "help" ; my $cmd2 = "dirs " ; my $cmd3 = "test" ; my $cmd1 = "xxxxx" ; my $cmd2 = "cd / " ; my $cmd3 = "pwd" ; Dave Rolsky wrote on 6/2/2004 4:59 PM: >On Wed, 2 Jun 2004, Dave Rolsky wrote: > > > >>On Wed, 2 Jun 2004, John Fisher wrote: >> >> >> >>>>Do other commands work? Have you tried something like just "ls"? >>>> >>>> >>>> >>>yes >>> ls pwd cd /somepath all work, and they work as succesive >>>commands >>>$ssh->cmd(somecommand)..... >>>$ssh->cmd(someothercommand)..... >>>$ssh->cmd(somethirdcommand)..... >>> >>> >>How about some other shell command (not an executable)? I'm guessing that >>when you log in via SSH without a terminal, you don't actually get a >>shell, but that's just a guess. >> >> >> ---------------------------------------------------- John P. Fisher at ZNYX Networks 805 683 1488 x 3245 joh...@zn... |
|
From: Dave R. <au...@ur...> - 2004-06-02 23:59:58
|
On Wed, 2 Jun 2004, Dave Rolsky wrote: > On Wed, 2 Jun 2004, John Fisher wrote: > > > >Do other commands work? Have you tried something like just "ls"? > > > > > yes > > ls pwd cd /somepath all work, and they work as succesive > > commands > > $ssh->cmd(somecommand)..... > > $ssh->cmd(someothercommand)..... > > $ssh->cmd(somethirdcommand)..... > > How about some other shell command (not an executable)? I'm guessing that > when you log in via SSH without a terminal, you don't actually get a > shell, but that's just a guess. > > > -dave > > /*======================= > House Absolute Consulting > www.houseabsolute.com > =======================*/ > /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: Dave R. <au...@ur...> - 2004-06-02 23:21:05
|
On Wed, 2 Jun 2004, John Fisher wrote: > When I use the perl script I get dropped into the normal environment, as > if the sudo line in .bash_profile had not run. when the source > .bash_profile is the first command given to the ssh object, I get this > debug text: <see below> and the second commend is never executed, the > script hangs. It feels like the perl module enters through another > mechanism than the standard command line ssh. Do other commands work? Have you tried something like just "ls"? If that doesn't work, the problem isn't the specific command. When you send a command, I'm not sure if shell commands will actually work, but I don't know enough about the inner workings of SSH to say (anyone?). -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: John F. <joh...@zn...> - 2004-06-02 23:09:13
|
I am trying to use the package to log into a server which uses chroot environments. As a person if I 'ssh -l username servername' I get dropped into the chroot environment. When I use the perl script I get dropped into the normal environment, as if the sudo line in .bash_profile had not run. when the source .bash_profile is the first command given to the ssh object, I get this debug text: <see below> and the second commend is never executed, the script hangs. It feels like the perl module enters through another mechanism than the standard command line ssh. Both servers are running Debian Woody. Any pointers much appreciated. John ### code ##### use strict; use diagnostics; use Net::SSH::Perl; my $cmd1 = "source /home/build/.bash_profile " ; my $cmd2 = "pwd" ; my $ssh = Net::SSH::Perl->new($host, debug => 1, protocol => 2); $ssh->login($user, $pass); my($out1, $err1, $exit1) = $ssh->cmd($cmd1); my($out2, $err2, $exit2) = $ssh->cmd($cmd2); #### debug message #### pt: Reading configuration data /root/.ssh/config pt: Reading configuration data /etc/ssh_config pt: Allocated local port 1023. pt: Connecting to nn.nn.nn.nn, port 22. pt: Remote protocol version 2.0, remote software version OpenSSH_3.0.2p1 Debian 1:3.0.2p1-9 pt: Net::SSH::Perl Version 1.23, protocol version 2.0. pt: No compat match: OpenSSH_3.0.2p1 Debian 1:3.0.2p1-9. pt: Connection established. pt: Sent key-exchange init (KEXINIT), wait response. pt: Algorithms, c->s: 3des-cbc hmac-sha1 none pt: Algorithms, s->c: 3des-cbc hmac-sha1 none pt: Entering Diffie-Hellman Group 1 key exchange. pt: Sent DH public key, waiting for reply. pt: Received host key, type 'ssh-dss'. pt: Host 'nnn.nnn.nn.nn' is known and matches the host key. pt: Computing shared secret key. pt: Verifying server signature. pt: Waiting for NEWKEYS message. pt: Enabling incoming encryption/MAC/compression. pt: Send NEWKEYS, enable outgoing encryption/MAC/compression. pt: Sending request for user-authentication service. pt: Service accepted: ssh-userauth. pt: Trying empty user-authentication request. pt: Authentication methods that can continue: publickey,password,keyboard-interactive. pt: Next method to try is publickey. pt: Next method to try is password. pt: Trying password authentication. pt: Login completed, opening dummy shell channel. pt: channel 0: new [client-session] pt: Requesting channel_open for channel 0. pt: channel 0: open confirm rwindow 0 rmax 16384 pt: Got channel open confirmation, requesting shell. pt: Requesting service shell on channel 0. pt: channel 1: new [client-session] pt: Requesting channel_open for channel 1. pt: Entering interactive session. pt: Sending command: source /home/build/.bash_profile pt: Requesting service exec on channel 1. pt: channel 1: open confirm rwindow 0 rmax 16384 -- ---------------------------------------------------- John P. Fisher at ZNYX Networks 805 683 1488 x 3245 joh...@zn... |
|
From: Dave R. <au...@ur...> - 2004-06-02 22:00:13
|
On Fri, 28 May 2004, Serguei Moukhine wrote:
> Am I doing something wrong? It looks like Net::SFTP does not recognize Host
> from ~/.ssh/config file.
>
> Should I always do something like this?
> $sftp = Net::SFTP->new('ctsapu001',(debug => 1, user => 'ace_event'));
I think so.
> =================================================
> $sftp = Net::SFTP->new('ACE1',debug => 1);
> =================================================
>
> cdvapu001: Reading configuration data /export/home/ace_event/.ssh/config
> cdvapu001: Reading configuration data /etc/ssh_config
> Net::SSH: Bad host name: ACE1 at
> /opt/fs_autosys/lib/perl/lib/site_perl/5.6.1/Net/SFTP.pm line 36
I don't think the code currently does a lookup in the config file for the
hostname passed as the first arg.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/
|
|
From: Dave R. <au...@ur...> - 2004-06-02 21:56:47
|
On Wed, 2 Jun 2004, Shapiro, David wrote: > Is there a way to have Net::SSH::Perl run using the public key with no > passphrase I set up? > > i tried commenting out login, but that did not work. I tried just using > $ssh->login($user), but that fails too. Is there some way I have to set up > the new object to allow me to use public key/no passphrase logins? Check out the identity_files option which can be passed to the new() method. I think that will do what you want. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |
|
From: Serguei M. <smo...@be...> - 2004-05-28 20:36:11
|
Hi Experts,
Am I doing something wrong? It looks like Net::SFTP does not recognize Host
from ~/.ssh/config file.
Should I always do something like this?
$sftp = Net::SFTP->new('ctsapu001',(debug => 1, user => 'ace_event'));
Thank you,
Sergei
=================================================
Entry for ACE1 in ~/.ssh/config file
=================================================
###########################
Host ACE1
protocol 2
User ace_event
Hostname ctsapu001
IdentityFile ~/.ssh/id_dsa
ForwardX11 no
BatchMode yes
###########################
=================================================
$sftp = Net::SFTP->new('ACE1',debug => 1);
=================================================
cdvapu001: Reading configuration data /export/home/ace_event/.ssh/config
cdvapu001: Reading configuration data /etc/ssh_config
Net::SSH: Bad host name: ACE1 at
/opt/fs_autosys/lib/perl/lib/site_perl/5.6.1/Net/SFTP.pm line 36
=================================================
ace_event@cdvapu001> ssh -v ACE1
=================================================
OpenSSH_2.9p2, SSH protocols 1.5/2.0, OpenSSL 0x0090602f
debug1: Reading configuration data /export/home/ace_event/.ssh/config
debug1: Applying options for ACE1
debug1: Reading configuration data /usr/local/etc/ssh_config
debug1: Seeded RNG with 46 bytes from programs
debug1: Seeded RNG with 3 bytes from system calls
debug1: Rhosts Authentication disabled, originating port will not be
trusted.
debug1: restore_uid
debug1: ssh_connect: getuid 2051 geteuid 2051 anon 1
debug1: Connecting to ctsapu001 [198.162.245.52] port 22.
debug1: temporarily_use_uid: 2051/1008 (e=2051)
debug1: restore_uid
debug1: temporarily_use_uid: 2051/1008 (e=2051)
debug1: restore_uid
debug1: Connection established.
debug1: identity file /export/home/ace_event/.ssh/id_dsa type 2
debug1: Remote protocol version 1.99, remote software version OpenSSH_2.9p2
debug1: match: OpenSSH_2.9p2 pat ^OpenSSH
Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_2.9p2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: dh_gen_key: priv key bits set: 130/256
debug1: bits set: 1034/2049
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ctsapu001' is known and matches the RSA host key.
debug1: Found key in /export/home/ace_event/.ssh/known_hosts2:1
debug1: bits set: 1032/2049
debug1: ssh_rsa_verify: signature correct
debug1: kex_derive_keys
debug1: newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: waiting for SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: done: ssh_kex2.
debug1: send SSH2_MSG_SERVICE_REQUEST
debug1: service_accept: ssh-userauth
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: authentications that can continue:
publickey,password,keyboard-interactive
debug1: next auth method to try is publickey
debug1: try pubkey: /export/home/ace_event/.ssh/id_dsa
debug1: input_userauth_pk_ok: pkalg ssh-dss blen 434 lastkey 1022c8 hint 0
debug1: read PEM private key done: type DSA
debug1: sig size 20 20
debug1: ssh-userauth2 successful: method publickey
debug1: channel 0: new [client-session]
debug1: channel_new: 0
debug1: send channel open 0
debug1: Entering interactive session.
debug1: client_init id 0 arg 0
debug1: channel request 0: shell
debug1: channel 0: open confirm rwindow 0 rmax 16384
Last login: Fri May 28 10:45:58 2004 from cdvapu001.futur
Sun Microsystems Inc. SunOS 5.8 Generic February 2000
You have new mail.
ace_event@ctsapu001>
|