Welcome to WebmasterWorld Guest from 23.22.206.103

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)

Junior Member

10+ Year Member

joined:Dec 17, 2003
posts:100
votes: 0


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)

Administrator

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

joined:July 31, 2003
posts:12541
votes: 1


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)

Junior Member

10+ Year Member

joined:Dec 17, 2003
posts:100
votes: 0


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)

Junior Member

10+ Year Member

joined:Nov 12, 2005
posts:136
votes: 0


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

Senior Member from US 

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

joined:Apr 19, 2003
posts:4397
votes: 2


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)

Junior Member

10+ Year Member

joined:Dec 17, 2003
posts:100
votes: 0


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)

Administrator

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

joined:July 31, 2003
posts:12541
votes: 1



But owners can change groups.

Then how about chgrp [php.net]?

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

Junior Member

10+ Year Member

joined:Dec 17, 2003
posts:100
votes: 0


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.