Jump to content

Recommended Posts

Posted (edited)

I would like to change my photo gallery to allow photo uploads from relatives, etc. The problem is that if someone uploads a photo, it's then owned by the nobody user. I've been told this is not a good thing plus I know it isn't because then I can't move or delete the files later as "spolemn".

 

I'd like the PHP script to upload the photo, resize the photo into another directory, and then change the ownership to "spolemn". How can I accomplish the final part? Is there a script/command I can exec() to do this?

Edited by DirkNiblick
Posted
I'd like the PHP script to... change the ownership to "spolemn". How can I accomplish the final part? Is there a script/command I can exec() to do this?

Unfortunately, there is no way for you to do this. Only the root user (i.e. the Help Desk) has the ability to change the owner of a file or directory. (This is a security restriction by the operating system.)

 

You basically have two options here:

 

1) Ask the Help Desk to change the ownership of uploaded files from "nobody" to your user ID every time one or more files are uploaded.

 

2) Configure your script to run as CGI script. As a CGI script, your script would run under your user ID instead of "nobody", so any files uploaded and created by such a script would be automatically owned by you.

 

You didn't say what script you were using for your photo gallery, so I don't know how feasible option #2 would be.

Posted
1) Ask the Help Desk to change the ownership of uploaded files from "nobody" to your user ID every time one or more files are uploaded.

well, maybe not every time you upload a photo

 

*TCH-Tim cringes at the thought of waking up to hundreds of tickets to change file ownership on pictures :)

Posted
Well, I guess I'll just have to leave them as owned by nobody. Thanks anyway.

I didn't say we wouldn't change ownership for you, I'm just asking that you batch your requests rather than open twenty tickets every day. I'm sure you can see my concern.

 

What script are you using? Maybe we can help you come up with a different method.

Posted

It's a PHP photo gallery I've written. I want to allow my relatives to upload pictures into the directories. Like I said, there's nothing wrong with letting the nobody user do it until I want to move/delete files created that way. I suppose I could just send in a help desk ticket to chown the directory.

Posted

Why not use Coppermine as your gallery, then you shouldn't have any problems with ownership etc.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...