JimZipCode has asked for the wisdom of the Perl Monks concerning the following question:
Hi – I just ported a perl script that uses Net-SFTP, over to another box that did not have Net-SFTP installed. After struggling with the dependencies, I installed Net-SFTP-Foreign-1.77 and IO-Tty-1.12 and modified my script. It runs now (and I'm delighted by how compatible all the methods are).
Is there a known issue with Net-SFTP-Foreign not reading the /etc/hosts file, to resolve host names? I have this line of code in my script:
my $sftp = Net::SFTP::Foreign->new(user => $remote_user, host => $remote_host, password => $remote_pswd);When variable $remote_host is set to the FQDN remote.server.com, script throws this error:
ssh: remote.server.com : Name or service not knownBut when the variable is set to the actual IP address, works fine.
I can sftp to remote.server.com (using FQDN) from the Linux command line, and it works fine. (I actually don't even need a hosts file entry to get there – the FQDN is resolved by normal resolution process.) I only see the issue in the script. Is this known behavior? Any parameter I have to set, to help it resolve?
Perl 5.8.8 running on RHEL5.
Thanks,
Jim
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net-SFTP-Foreign not reading /etc/hosts file?
by salva (Canon) on Sep 13, 2015 at 17:37 UTC | |
|
Re: Net-SFTP-Foreign not reading /etc/hosts file?
by Anonymous Monk on Sep 14, 2015 at 08:23 UTC |