KateYoak has asked for the wisdom of the Perl Monks concerning the following question:

Hey guys,

I am finding that apache environment lacks *something* that bash has to make an ssh request. The question is, is there any way to bring that something in, or do I have to run SSH/SFTP requests from shell?

I am running an sftp login with username and password using Net:::SFTP. Debug logs are identical from the shell and apache. The only differences are that
  • the one from Apache runs an order of magnitude slower (I wonder why?)
  • most importantly, it hangs at
  • sftp: Sending SSH2_FXP_INIT
    I have tried to do all I could to make the environment similar, but without knowing what to look for, didn't hit the solution yet.

    I am running apache 2.2.3, mod_perl 2.0.4, perl 5.8.8, Net::SFTP 0.10, OpenSSL 0.9.8 . No interesting parameters sent to Net::SFTP constructor, just debug.

    Thanks for your help!
    Kate

    Replies are listed 'Best First'.
    Re: Net::SFTP hangs in apache environment
    by salva (Canon) on Aug 30, 2011 at 06:28 UTC
      Are you running your scripts from the shell and from Apache as the same user? Net::SSH::Perl reads its configuration from ~/.ssh/config.

      Have you installed modules in some custom path that has not been configured on mod_perl? Try running your programs with strace (or similar) and check that both versions use the same modules.

      Besides that, Net::SFTP has not been maintained since a long time ago and have lots of unsolved bugs. Try using Net::SFTP::Foreign (or Net::SFTP::Foreign::Compat) instead.