Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Error with Net::SFTP:Foreign

by pileofrogs (Priest)
on Aug 11, 2010 at 17:55 UTC ( [id://854467]=note: print w/replies, xml ) Need Help??


in reply to Error with Net::SFTP:Foreign

I haven't used Net::SFTP::Foreign before, but I have run into similar problems.

Usually this type of problem comes from your script consulting a different known_hosts file than your command line. EG your command line runs as a user and your script runs as root. One option is to insert the host keys for all the hosts in the /etc/ssh/known_hosts file. That way it won't matter which user the script is running as. See ssh-keyscan for details.

Replies are listed 'Best First'.
Re^2: Error with Net::SFTP:Foreign
by ScooterTrash (Novice) on Aug 11, 2010 at 18:59 UTC

    Thanks for the reply. I thought about that issue and in the script I checked the user id I am executing as and it is root. In root's home directory I have the .ssh/known_hosts file with the key in it. If I remove the key and execute the sftp from the command line it detects there is no current key and prompts if I want to add it. I reply with yes and it adds the key. I will try adding the /etc/ssh/known_hosts to see if that helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://854467]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 16:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found