Resetting Ownership on multiple files

bashy

Verified User
Joined
Jul 21, 2006
Messages
73
Hi folks

I have a downloads folder with about 400 files and apache owns them all
I can reset ownership 1 by 1 but this will take days, is there a way to batch
this job please, or does anyone know a wayto do it for all the files in 1 shot?

The folder is owned by me just not the files :(
 
Hi folks

I have a downloads folder with about 400 files and apache owns them all
I can reset ownership 1 by 1 but this will take days, is there a way to batch
this job please, or does anyone know a wayto do it for all the files in 1 shot?

The folder is owned by me just not the files :(

Login to shell and type and cd into the folder, then type:

chown -R username:username *
 
This would be nice if it would be possible but as normal user you'll get:
chown: changing ownership of `...l': Operation not permitted

How can we solve this problem?
I'm looking for a *real* solution - so I will not have to request the admin to repair the ownership.

I just wonder why this doesn't work by default: this design bug is breaking almost any software including: joomla, mediawiki, ....

The default directadmin configuration should be made in such way so users will not stuck to this.
 
Last edited:
I don't understand why you're referring to normal unix/linux behavior as a bug. It's not a bug but rather normal behavior, designed for security. If a file is loaded by apache it's owned by apache.

I suppose you could request a change be made to DirectAdmin (this is the wrong subforum for that), wait for DirectAdmin to be updated, and then wait until your server administrator notices that DirectAdmin has been updated, and installs the update.

Or you could just ask your administrator (someone with root access to the server) to do it for you; it takes literally seconds.

And then you could ask your administrator to switch the server from running PHP as an apache module, to running it as a CGI program, in which case uploads by PHP won't have the Apache ownership but rather your user ownership.

Before DirectAdmin offered PHP/CGI I, as administrator for my servers, was happy to set up cron jobs that ran every few minutes, for each of our users that needed to remove files manually that were updated by joomla, etc.

Or you could always write a small PHP program to do the deleting for you.

Be sure to password protect it; otherwise anyone will be ble to delete files.

Jeff
 
As Jeff said php created the files, php can delete them.

And the design flaw is in the scripts you are using not DA or Linux. The people who write the scripts should include a way of deleting the files.
 
It will do the job though. It should be password protected too.
 
Back
Top