pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mitch Vincent <mitch@venux.net>
To: Richie <dugganr@student.cs.ucc.ie>
To: pgsql-php@postgresql.org
Subject: Re: Using system call + wrapper?
Date: Mon, 26 Feb 2001 12:31:53 -0500
Message-ID: <01d801c0a01a$05bc1520$0200000a@windows> (raw)
References: <Pine.OSF.3.96.1010226165044.29671A-100000@student.cs.ucc.ie>

> I am trying to allow people to save images from their file system to a
> directory on my machine called images, for example the path that I want to
> save to is /usr/local/apache/htdocs/project/images/.
>
> Obviously from above I am using an Apache web server, PHP and PostgreSQL.
> My problem is that you need sudo access to save anything to this
> directory so I get a "Permission denied..." error on the browser. I want
> to save the image to the images directory and save the path to a table in
> my database, however I can do neither in the current situation.
>
> It was suggested to me to use a wrapper that invokes a system call such as
> system('sudo upload.php -p password') that will run the program in sudo
> but I really don't know where to start with this??

The easiest thing to do is allow the web server write access to the upload
directory or perhaps some creative use of sym links would work.. This one is
a little out there but you could also save the files in a temporary
directory and have a cron job every minute or so go through and copy
everything in that directory over to the one you need the files in. If
you're using PHP as an apache module then I don't think you can run a single
script as a different user, though you might want to check on apache's
su-exec functionality for CGI scripts.. If you're running a CGI you could
always use the ever-so-insecure suid bit solution but I would suggest
against it..

Good luck!

-Mitch






view thread (7+ messages)  latest in thread

Message-ID: <01d801c0a01a$05bc1520$0200000a@windows>
Permalink:  ../01d801c0a01a$05bc1520$0200000a@windows/
Also on:    postgresql.org/message-id/01d801c0a01a$05bc1520$0200000a@windows

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: mitch@venux.net, dugganr@student.cs.ucc.ie
  Subject: Re: Using system call + wrapper?
  In-Reply-To: <01d801c0a01a$05bc1520$0200000a@windows>
  References: <Pine.OSF.3.96.1010226165044.29671A-100000@student.cs.ucc.ie> <01d801c0a01a$05bc1520$0200000a@windows>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox