Hi there!

I'm posting this thread hopping there's a way to solve my problem, but i'm sure, i'll get a netgative answear.

I've file upload script, it works fine, the only problem is files get user: Apache and Group: Apache

I'll would like to change them to my u: (scripters) and g: (users), but when i try to access the chown() function within php, i get the following error:
Warning: chown failed: Operation not permitted in /home/scripters/public_html/upload.php on line 30

Well if I can't use chown to change the group/owner from the uploaded files, is there a way i can change them ?

I'd like a solution, but the only one i found 'till now, was a bash script doing 'chown -R' every hour, running as root.

Thanks,

kil

    h there!

    well i tryed to user chown, and it gave to me a 'invalid operation' as i said on my original post :s try those functions before

    but thanks anyway 🙂

      putting on the reading glasses So my young friend I can see you have tried the chown function. ;-)

      I dont think you can change to another group than yourself, in this case apache.

      Have you tried to change it to apache just to see that you are using the function correct?

        I was trying to use them well, and i think i know why it didn't let me change them.

        It's not a PHP issue, but a server one, i need to be a part of apache group, in order to be hable to change my group files to apache ones, and vice-versa.

        I could ask my admin to relate me with that group aswell, but if that was the case, other users would have the possibility to exploit my home dir, so i'll just the admin to add the bash script i coded to his crontab 🙂

        Well, thanks a lot man 🙂

        cheers,
        kil

          my two cents real fast... i had the same prob about 2 weeks ago. trying to get it so that i was the owner of 'said files'. well, after going through a few ideas 1. chown, chgrp, chmod... didnt' work right because of ownership probs and group probs 2. cron job to fix it.. this would work if ran as admin, but, i wanted complete control over what happend, not a script that ran ever 5 minutes or whatever.. i wanted it instant. 3. i finally realized that i didn't even have to change ownership of the file.. i could read it and copy it just fine, just couldn't delete it as me, so to fix this issue i setup a file manager where the owner was apache (normal script file operations are done by apache not me) so this worked fine. my 4th idea was to use ftp functions. logging in as me (the right user) making the right directorys and putting the files where i wanted etc. but i had some problems with this, but the ownership problem was eliminated.. anyway. i dunno what u'r trying to do, but, that might give u other ideas as well. > cheers

            Howdy froznic,

            my problem was the same as yours, i want full control of the files.
            i did your second option, a few hours ago, where i begged my admin to put a bash script, changing the owner and group from all the files, hourly.

            btw, your FTP idea rules 🙂

            thank you guys for all the help

            cheers,
            kil

              Write a Reply...