+ Post New Thread
Results 1 to 8 of 8
*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 ...
  1. #1


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339

    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

  2. #2

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,403
    Thank Post
    637
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    319

    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.

  3. #3

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    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.

  4. #4


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339

    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

  5. #5

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,403
    Thank Post
    637
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    319

    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.

  6. #6


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339

    Re: Apache Permissions

    thats it -SGID :!:

    thank you

  7. #7

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    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.

  8. #8


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339

    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:
+ Post New Thread

Similar Threads

  1. Apache on Windows with SSL.
    By maniac in forum How do you do....it?
    Replies: 4
    Last Post: 20th November 2007, 04:07 PM
  2. Apache 2.2 and mod_perl
    By apeo in forum Web Development
    Replies: 3
    Last Post: 6th November 2007, 10:40 AM
  3. Apache on windows
    By apeo in forum Windows
    Replies: 16
    Last Post: 28th March 2007, 01:09 PM
  4. Apache Question.
    By in forum Web Development
    Replies: 6
    Last Post: 27th April 2006, 09:29 AM
  5. Apache + IIS On the same box?
    By in forum Windows
    Replies: 25
    Last Post: 7th March 2006, 03: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
  •