Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Apache + Php server, file folder owners and user groups
Hello friends;
I've apache 1.3 and php5 server (CentOS 4) with proftpd.
Apache runs at User: apache, Group: web
User directories like this
/home/xxx.com/public_html (User: xxx.com, Group: web - and all subfiles,subfolders)
/home/yyy.net/public_html (User: yyy.net, Group: web - and all subfiles,subfolders)
And I've proftpd server. All users have their own ftp access to only their homes.
Everything works great. But I've two questions.
1) When i upload a file with php over apache, uploaded files owner are apache, group are web. Apache's user and group. How can i change it's owner to xxx.com or yyy.net after upload? Or is there any other solution ?
Suexec: If i run apache with site's users (xxx.com user for /home/xxx.com, and yyy.net user for /home/yyy.net) all scripts will have write and delete access at their site. So that i don't need to chmod folders to 0777 for reading and writing. Site panels (plesk, cpanel vs..) are different.
2) All sites have the same group, so i can read all files. I can access xxx.com's files from yyy.net. How can i disable this?
Last edited by Seregwethrin; 03-10-2008 at 04:36 AM.
1) When i upload a file with php over apache, uploaded files owner are apache, group are web. Apache's user and group. How can i change it's owner to xxx.com or yyy.net after upload? Or is there any other solution ?
In php, after uploading the file, can't you just do something like
exec('chown owner.owner filename.ext');
I know php has a chmod() that you can do, I think it also has a chgrp() / chown() filesystem library call in the PHP core?
I. e. you upload the file, then change it with PHP to another group / user that is NOT Apache's "nobody" user?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.