/    Sign up×
Community /Pin to ProfileBookmark

How can I delete files owned by nobody?

I’ve got FCKeditor installed.
When you upload an image with it: it stores it as a file owned by nobody.

I’ve got a separate piece of PHP code that I am having coded for me.
We’ve run into a small problem: it can’t delete nobody owned files.

No good to me: I need to be able to *just* delete the file!

I’ve googled and the only way so far I can see is that I have to be logged in as root and then I can delete on the command line.

I’m screwing my head over this!

What’s the answer.

Thanks.

OM

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@knowjMar 02.2008 — 2 options: see if you can chmod the file to 777 then delete (I don't think this will work in this case)

Use shell to login to the server and change the owner then delete.

We had a similar issue before and the only way we could do anything was via the shell
Copy linkTweet thisAlerts:
@OM2authorMar 02.2008 — thats crazy!

there has to be a solution by using php only?

i need to run a script to a directory and all files below it.

are you saying that i cant do this? ?

i looked up google more.

and i came across a posting saying that if you use the following command, then u can delete afterwards:

unlink('filename.jpg');

do u have any thoughts about this?

let me know.

thanks.
Copy linkTweet thisAlerts:
@NogDogMar 02.2008 — The "nobody" user is the web server user under whom your PHP scripts are executed when PHP is run as a web server module. Therefore, any files created by your PHP scripts will be owned by "nobody" (who is, in fact, somebody ? ). Therefore, your two options (not including intervention by somebody with root permission on the server) are to have a PHP script do the deletion via unlink(), or having the PHP script that creates the file in the first place set the permission to 0666 or 0777 via chmod() so that any user can delete it.
Copy linkTweet thisAlerts:
@OM2authorMar 02.2008 — ok... thanks for that.

at least if there's a way out with unlink function: then that's ok.
Copy linkTweet thisAlerts:
@MrCoderMar 04.2008 — Could it be that FCKeditor is setup wrong?
Copy linkTweet thisAlerts:
@ZnupiMar 05.2008 — The unlink function is the one that actually deletes the file. It has nothing to do with permissions. Try setting the permissions on the folder that contains the images to 777:
chmod 777 /path/to/images
^ run that as root, and then try your script which just calls unlink() on the files you need deleted. Again, unlink() is the function that DELETES the file:
unlink — Deletes a file[/quote]
×

Success!

Help @OM2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...