On Aug 16, 2:16 pm, Super Steve <[email protected]> wrote:
> I'm working on a website that uses PHP and I need to allow users to
> upload files, which will then be copied into a directory within the
> website.  I am having problems with the permissions on the directory
> that will hold the uploaded files.  The website is hosted on a virtual
> host, and I don't have telnet access, just FTP access.
>
> If I FTP into the website and create the upload directory then the
> owner and group is set to my FTP username.  The permissions on the
> upload directory are 775 (i.e. owner can do everything, group can do
> everything, public can only read and execute but not write).

The usual way to deal with this is to use the group sticky (setgid)
bit.

When set on a directory, this will cause all new files created within
the
directory to have the same group as the directory.  If the directory
was
group owned by your FTP user, the apache user would need to be a
member
of that group.  If the directory was group owned by the apache user,
your
FTP user would need to be a member of the apache group.

Not sure if you can set sticky bits via FTP though, you'll be looking
to set
the mode to 4775.

See http://en.wikipedia.org/wiki/Setuid#setuid_and_setgid_on_directories

Malc

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to