Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Net::SFTP::Foreign mod perl

by perrin (Chancellor)
on May 21, 2009 at 19:00 UTC ( [id://765529]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Net::SFTP::Foreign mod perl
in thread Net::SFTP::Foreign mod perl

The user depends on how you configure it, but usually CGI programs don't run as the same user that apache runs as. Another potential difference is environment variables.

Replies are listed 'Best First'.
Re^4: Net::SFTP::Foreign mod perl
by scoobyrico (Beadle) on May 21, 2009 at 19:42 UTC
    Taking your suggestion, I took permissions out of the equation and just did an $sftp-ls() and print to the log what it found there and it's not even reading that.
    my $sftp = Net::SFTP::Foreign->new(host =>$host, password => $password +, user => $username, ssh_cmd => 'ssh', more => [-v], port=>22); # or +die "Cannot connect to $@"; warn( "####################### Connected #######################\n") +; #$sftp->put("file.txt", "file.txt", copy_perm => 0);# or die "Cannot +connect to $@"; + my @files = $sftp->ls(); foreach my $f ( @files ) { foreach my $file_ref ( @{$f} ) { print "Found file: " . $file_ref->{'filename'} . "<br>\n"; } }
    I do agree that ENV vars do have something to do with this, but haven't seen anything here or off of a google search to tell me which ones it would be. Again thank you for your suggestions.

      I'm thinking the permissions problem would be happening during the connection, not on the FTP server. It's trying to use ssh credentials, so maybe it can't find the right key file or an enclosing directory is group-writable. SSH is finicky about that.

      For %ENV stuff, just print out what it is under CGI and under mod_perl and look for differences.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 07:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found