*nix Thread, Apache Permissions in Technical; Some time a go I set up a LAMP server for students to do mysql/php work on.
I used mod_userdir ...
-
28th April 2006, 12:07 PM #1 Apache Permissions
Some time a go I set up a LAMP server for students to do mysql/php work on.
I used mod_userdir so that individual students have their own workspace and enabled samba to give them smb access.
All if fine except that during the course some of the students have made web-pages that allow files to be uploaded.
Because Apache runs under the user wwwrun when files are uploaded using the students custom php scripts the files are then owned by wwwrun. Since the user does not own the file they uploaded they cannot delete it using samba.
Whats the best way around this problem other than running apache as root (not going to happen), or have cron periodically chown the files ?
thanks
-
-
IDG Tech News
-
28th April 2006, 12:09 PM #2 Re: Apache Permissions
Probably change the group membership of the samba users and/or wwwrun, so that whoever group name it is has read/write/execute access to the parent folder that the files are located in and the files themselves.
-
-
28th April 2006, 12:28 PM #3 Re: Apache Permissions
It's not your fault your students PHP scripts have bugs! 
Students should be using the chgrp(), chmod(), and chown() PHP functions to set the right permissions on the files.
-
-
28th April 2006, 12:45 PM #4 Re: Apache Permissions
Students should be using the chgrp(), chmod(), and chown() PHP functions to set the right permissions on the files.
I think the server would need to run as root in order for the students to use those functions (and chown from the wwwrun user to the student user). But I take your point, maybe if students have learned how to create files in php then they must learn how to list and delete them 
Probably change the group membership of the samba users and/or wwwrun, so that whoever group name it is has read/write/execute access to the parent folder that the files are located in and the files themselves
problem is that the default permission the files save as don't allow group write access
Code:
-rw-r--r-- 1 wwwrun www 7596 2006-04-26 20:46 logo.gif
is there a way of changing the default permissions when a file is created - I know samba can do this, but say I created a new file on the CLI - what is it that determines the rwx permissions?
thanks
-
-
28th April 2006, 01:03 PM #5 Re: Apache Permissions
http://www.linuxforums.org/security/...rmissions.html
Look near the bottom for SGID etc and umask.. might be what you're after.
-
-
28th April 2006, 01:11 PM #6 Re: Apache Permissions
thats it -SGID :!:
thank you
-
-
28th April 2006, 01:13 PM #7 Re: Apache Permissions
I think the server would need to run as root in order for the students to use those functions (and chown from the wwwrun user to the student user).
No, if they own the parent directory they can do what they like.
-
-
28th April 2006, 01:20 PM #8 Re: Apache Permissions
PostPosted: Fri Apr 28, 2006 2:13 pm Post subject: Re: Apache Permissions
Quote:
I think the server would need to run as root in order for the students to use those functions (and chown from the wwwrun user to the student user).
No, if they own the parent directory they can do what they like.
cool, not only do I have it working, but I've learned 2 useful things.
thanks guys
-
SHARE:
Similar Threads
-
By maniac in forum How do you do....it?
Replies: 4
Last Post: 20th November 2007, 05:07 PM
-
By apeo in forum Web Development
Replies: 3
Last Post: 6th November 2007, 11:40 AM
-
Replies: 16
Last Post: 28th March 2007, 01:09 PM
-
By in forum Web Development
Replies: 6
Last Post: 27th April 2006, 09:29 AM
-
Replies: 25
Last Post: 7th March 2006, 04:12 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules