Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Net::SFTP::Foreign mod perl

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


in reply to Net::SFTP::Foreign mod perl

You're probably running as a different user and possibly don't have the right permissions to read/write some files that it needs.

Replies are listed 'Best First'.
Re^2: Net::SFTP::Foreign mod perl
by scoobyrico (Beadle) on May 21, 2009 at 18:51 UTC

    I might agree with that, except that the file I am trying to upload is using permissions of 755, and the script will work from the command line as the apache user, or really any of the users on that box. Does apache under mod perl have a different user other than the other perl interpretor? On our server we call it 'apache'. And the mod perl and cgi perl interpretors both use the same httpd.conf file. This really is a configuration of mod perl type question, so maybe this isn't the best form here.

    I do thank you for the suggestion, and maybe there is something that I am missing in the httpd.conf. What information might I provide to track this down?

      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.
        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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-19 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found