CyberNerd Posted April 28, 2006 Posted April 28, 2006 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
webman Posted April 28, 2006 Posted April 28, 2006 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.
Geoff Posted April 28, 2006 Posted April 28, 2006 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.
CyberNerd Posted April 28, 2006 Author Posted April 28, 2006 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 -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
webman Posted April 28, 2006 Posted April 28, 2006 http://www.linuxforums.org/security/file_permissions.html Look near the bottom for SGID etc and umask.. might be what you're after.
Geoff Posted April 28, 2006 Posted April 28, 2006 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.
CyberNerd Posted April 28, 2006 Author Posted April 28, 2006 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now