misterperl has asked for the wisdom of the Perl Monks concerning the following question:
Recently I started using the Net::SSH and SFTP Perl modules, and they created and used a new file known_hosts2. Is there a way I can force them to use the existing file, and not add a new one? I need to connect to nodes in the known_hosts file but these modules seem to ignore it.
Remarkably even if I explicitly TELL it what hostfile to use, it ignores that and uses known_hosts2:
..which seems to be 100% disregarded. I examined the ssh object and this doesn't appear in it at all after returning from login() (it is there after new()my $keyfile='~/.ssh/known_hosts'; Net::SSH::Perl->new( $host, [identity_files => [$keyfile]);
I studied the metacpan page for SFTP; I don't see a way to specify to use the existing file in the new() args, so I'm not sure if this approach is even meaningful.
The known_hosts file has the default privs. According to chatbot AI, privs > 600 are acceptable. They are in fact 700.
Advice please? I don't want to fork this file (for now I cut the new keys from hosts2 and pasted them into hosts, and deleted hosts2.)
Rolf is this in your wheelhouse (hope so , your replies are ALWAYS amazingly helpful!)....
On a related note, I was in the debugger stepping through Net::SSH::Perl::AuthMgr and reached this line:
I've never seen a syntax like $object->(list) ; seems like the a method name is missing? IS there a default class method? This is the point where the connection errors..$code->($amgr, $packet, @args);
- MP
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why does Net::SFTP and Net::SSH::Perl not use "known_hosts"
by pryrt (Abbot) on Apr 20, 2023 at 17:38 UTC | |
|
Re: Why does Net::SFTP and Net::SSH::Perl not use "known_hosts" (coderefs)
by hippo (Archbishop) on Apr 20, 2023 at 15:12 UTC | |
|
Re: Why does Net::SFTP and Net::SSH::Perl not use "known_hosts"
by kcott (Archbishop) on Apr 20, 2023 at 16:38 UTC | |
|
Re: Why does Net::SFTP and Net::SSH::Perl not use "known_hosts"
by atcroft (Abbot) on Apr 22, 2023 at 00:26 UTC |