Subject: | Use of uninitialized value in concatenation (.) or string at Net/SSH/Perl.pm line 107. |
When using Net::SSH::Perl (via Net::SFTP), warnings, and strict in a CGI script running under Apache on RHEL... Net::SSH::Perl tries to use /.ssh/config instead of the Apache user's config due to $ENV{'HOME'} not being set.
Line 107:
my $user_config = delete $arg{user_config} || "$ENV{HOME}/.ssh/config";
A safer method would be to use getpw* (possibly if $ENV{HOME} is empty)
Examples:
use English;
my ($name,$passwd,$uid,$gid, $quota,$comment,$gcos,$dir,$shell,$expire) =
getpwuid($UID); # $> if not using 'use English;'
my $home = (getpwuid($>))[7];
Workaround:
Hard code $ENV{'HOME'} or setting $ssh_args{'user_config'} = '/some/path' in CGI scripts.