LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-09-2008, 03:58 PM   #1
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Rep: Reputation: 16
Question 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.
 
Old 03-11-2008, 01:39 PM   #2
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by Seregwethrin View Post
Hello friends;

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?
 
Old 03-11-2008, 02:15 PM   #3
Seregwethrin
Member
 
Registered: Feb 2008
Posts: 112

Original Poster
Rep: Reputation: 16
Yes i can do it with php but i want it automatic.

For example, editing scripts like vBulletin, IPB, Joomla for that is very difficult.
 
  


Reply

Tags
apache, chown, group, httpd, owner, permission, user


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
root can access a partition and see owners/groups/perms, user gets question marks lurko Debian 2 10-05-2006 11:30 AM
slackware owners and groups BiThian Slackware 2 08-29-2006 12:34 PM
Apache/PHP - loading file from another server Ultrus Linux - Software 7 04-19-2006 08:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration