Welcome to WebmasterWorld Guest from 23.20.241.155

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

fopen/fwrite and owner/group settings

How to change the owner/group?

     
8:55 am on Jan 5, 2006 (gmt 0)

10+ Year Member



Hello there,

I Have a problem with some file writeing.

I Use fopen to create a new file, but that file gets the owner and group the same as the apache owner and group.

How can i change it so that the file gets the same owner/group as the files i upload with FTP?

If you think this post belongs to apache then please move this post :).

Thx in advanced,
BlackDex

2:26 pm on Jan 5, 2006 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Why would you want to change the owner/group to the FTP user? Why not keep it as the user that uploaded the file?
10:16 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



Um....

That is what i mend :p

I think i just fraised it wrong..

I Want the owner of the file to be the owner when it gets executed.

And that isn't the way it is now.

10:24 pm on Jan 5, 2006 (gmt 0)

5+ Year Member



exec("chown newowner /path/to/the/file.jpg");
12:18 am on Jan 6, 2006 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



If you do not run your own server
check with your ISP

Quite a few ISPs won't allow you to change ownership

9:28 am on Jan 6, 2006 (gmt 0)

10+ Year Member



Well...
chown doesn't work...
Only root can change owners (atleast on our server).
But owners can change groups.

Anway..

The only solution i can find is to use suExec or something like that.
But that means i have to use CGI, and then the perferonase goes down.

Is there an other solution for this problem?

Thx in advanced.

4:16 pm on Jan 6, 2006 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member




But owners can change groups.

Then how about chgrp [php.net]?

5:36 pm on Jan 6, 2006 (gmt 0)

10+ Year Member



chgrp is fine, if you want to let the group have write access.
But on a server with multiple hosts this just isn't secure.

i Mabye have found a create tool that works just like suExec for CGI scripts.

Thisone is called suPHP [suphp.org], this together with Safe_Mode should do the trick of what i want :).

It will start the script using the owner/group of the script, and therefor every file created by that script will be of the same owner/group.

I haven't tryed it yet, but i have seen some good posts about it.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month