Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Error in Login by useing Net::OpenSSH

by Plankton (Vicar)
on Nov 11, 2011 at 06:34 UTC ( #937531=note: print w/replies, xml ) Need Help??


in reply to Error in Login by useing Net::OpenSSH

Hmmm ...
Couldn't establish SSH connection: unable to establish master SSH conn +ection: the authenticity of the target host can't be established, the + remote host public key is probably not present on the '~/.ssh/known_ +hosts' file at RDF.pl line 14.
... actually this error message tells us a lot. It tells us that the remote host public key is not in ~/.ssh/known_hosts file. After looking and man ssh_config one can see that this can be controlled by the ssh client with the StrictHostKeyChecking option. From the ssh_config man page:

If this flag is set to “yes”, ssh(1) will never automatically add host keys to the ~/.ssh/known_hosts file, and refuses to connect to hosts whose host key has changed. This provides maximum pro‐ tection against trojan horse attacks, though it can be annoying when the /etc/ssh/ssh_known_hosts file is poorly maintained or when connections to new hosts are frequently made. This option forces the user to manually add all new hosts. If this flag is set to “no”, ssh will automatically add new host keys to the user known hosts files. If this flag is set to “ask”, new host keys will be added to the user known host files only after the user has confirmed that is what they really want to do, and ssh will refuse to connect to hosts whose host key has changed. The host keys of known hosts will be verified automatically in all cases. The argument must be “yes”, “no”, or “ask”. The default is “ask”.

So you may want to disable StrictHostKeyChecking by doing something like:

$ssh = Net::OpenSSH->new($host, master_opts => [-o => "StrictHostKeyChecking=no"], ...);

Replies are listed 'Best First'.
Re^2: Error in Login by useing Net::OpenSSH
by Anonymous Monk on Apr 02, 2013 at 19:30 UTC
    Was having the same problem and this helped! Thanks! :)

      Thanks a lot, your solution saved my day !!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://937531]
help
Chatterbox?
[erix]: hm, where's tux when you need him?
[ELISHEVA]: what's curiouser is that the underlying Text::CSV_XS appears to be BOM-friendly
[afoken]: DBD::CSV has a csv_class attribute. You could subclass Text::CSV_XS to handle BOMs, e.g. through File::BOM.
[ELISHEVA]: Text::CSV_XS already can handle boms - see its detect_bom flag
[ELISHEVA]: but it seems that the DBD::CSV layer on top of it doesn't
[afoken]: Also: All other attributes that start with csv_ and are not described above will be passed to Text::CSV_XS (without the csv_ prefix).
[Discipulus]: what about a good 'ol SOPW?
[erix]: Giro d'Italia won by Dumoulin (peccato Nibali)
[ELISHEVA]: csv_detect_bom doesn't work either
[erix]: (SCNR)

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-05-28 20:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?