Subject: | "Identity Key Not Found Error" - But It Is There (and cmdline works) |
I get a warning to say that the identity key is not there when I pass in
a "-i" option via "more". It is actually there and the command works if
I use the commandline though. If I specify no identity key, the module
does what I expect it to.
Perl Version:
bash-3.00$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=solaris, osvers=2.8, archname=i86pc-solaris-thread-multi
uname='sunos thor 5.8 generic_117351-46 i86pc i386 i86pc'
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -xO3 -xarch=386 -xspace -xildoff
-I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-xO3 -xarch=386 -xspace -xildoff',
cppflags='-D_REENTRANT -xO3 -xarch=386 -xspace -xildoff
-I/opt/csw/bdb44/include -I/opt/csw/include'
ccversion='Sun C 5.8 Patch 121016-05 2007/01/10', gccversion='',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-L/opt/csw/bdb44/lib -L/opt/csw/lib -L/usr/lib
-L/usr/ccs/lib -L/opt/SUNWspro/prod/lib -L/lib'
libpth=/usr/lib /usr/ccs/lib /opt/SUNWspro/prod/lib /lib /opt/csw/lib
libs=-lsocket -lnsl -lgdbm -ldb-4.4 -ldl -lm -lpthread -lc
perllibs=-lsocket -lnsl -ldb-4.4 -ldl -lm -lpthread -lc
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so.5.8.8
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R
/opt/csw/lib'
cccdlflags='-KPIC', lddlflags='-G -L/opt/csw/bdb44/lib
-L/opt/csw/lib -L/usr/lib -L/usr/ccs/lib -L/opt/SUNWspro/prod/lib -L/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API USE_SITECUSTOMIZE
Built under solaris
Compiled at Oct 5 2007 13:01:00
@INC:
/opt/csw/lib/perl/5.8.8
/opt/csw/share/perl/5.8.8
/opt/csw/lib/perl/site_perl
/opt/csw/share/perl/site_perl
/opt/csw/share/perl/site_perl
/opt/csw/lib/perl/csw
/opt/csw/share/perl/csw
/opt/csw/share/perl/csw
Module version:
1.35 (as reported by "print $Net::SFTP::Foreign::VERSION")
Operating System:
bash-3.00$ uname -a
SunOS isengaard 5.10 Generic_120012-14 i86pc i386 i86pc
This is Solaris 10 as downloaded from http://www.sun.com/
Offending code:
sub send_lorum {
debug("Attempting to send $enc_filename!");
my $sftp =
Net::SFTP::Foreign->new( host => "localhost", more => [ '-i
/home/lloy0076/.ssh/id_rsa', ], )
;
my $cwd = $sftp->cwd();
my $entries = $sftp->ls();
debug("CWD: $cwd");
}
Here's what I get:
2008-04-29 11:3 DEBUG main isengaard
WestpacConnectivityTest/simple.pl 63 :: Attempting to send lorum.txt.asc!
Warning: Identity file ../../../.ssh/id_rsa does not exist.
That debug is from Log::Log4perl and shouldn't be causing the issue.
I decided to ferret about and work out what was being sent:
DB<9>
Net::SFTP::Foreign::new(/opt/csw/share/perl/site_perl/Net/SFTP/Foreign.pm:294):
294: push @open2_cmd, _ensure_list($more)
DB<9>
Net::SFTP::Foreign::new(/opt/csw/share/perl/site_perl/Net/SFTP/Foreign.pm:297):
297: push @open2_cmd, $host, -s => 'sftp';
DB<9> p $open2_cmd
DB<10> print "@open2_cmd";
ssh -i /home/lloy0076/.ssh/id_rsa
I took that "ssh" command and ran it in the terminal without the
relevant warning. That "WARNING" which eventually occurs here:
DB<13> n
Net::SFTP::Foreign::new(/opt/csw/share/perl/site_perl/Net/SFTP/Foreign.pm:370):
370: $sftp->{pid} = eval { open2($sftp->{ssh_in},
$sftp->{ssh_out }, @open2_cmd) };
DB<13> n
Net::SFTP::Foreign::new(/opt/csw/share/perl/site_perl/Net/SFTP/Foreign.pm:370):
370: $sftp->{pid} = eval { open2($sftp->{ssh_in},
$sftp->{ssh_out }, @open2_cmd) };
DB<13> n
Net::SFTP::Foreign::new(/opt/csw/share/perl/site_perl/Net/SFTP/Foreign.pm:371):
371: if ($pid != $$) { # that's to workaround a bug in
IPC::Open3 :
DB<13> Warning: Identity file /home/lloy0076/.ssh/id_rsa not
accessible: No s uch file or directory.
...does NOT appear to be be an exception/die/croak (i.e. something that
would cause the "eval" to put something in $@).
In my current use case, I can get by with just using the "default" key
but I think this is a bug of some description.
NOTE:
I tried changing my default key to "id_rsa.not" and then changing my
call to this module with more => [ "-i /home/lloy0076/.ssh/id_rsa.not" ]
and/or putting it in /tmp and the module totally failed to use the key
(or ssh failed) and then asked me for a password.
EXPECTED BEHAVIOUR:
1. The module would pass the "-i /somewhere/private_key" to ssh in such
a way that ssh didn't provide the WARNING and then fail to use the
private_key
Thanks for your time!
DSL