Gutsy+LAMP+New Webroot?

topic posted Mon, October 22, 2007 - 9:44 PM by  PixelSlut //...
Share/Save/Bookmark
Advertisement
well i ended up reinstalling my machine linux laptop with Gutsy today. I had everything set up the way i liked it in fiesty but i seem to have problems mimicking the same setup in Gutsy for sme reason.

Ive got a partition i want to use for general storage. All the users on the machine in a particular group need to have access to this drive (lets call that group mydevs). What i want to do is move /var/www to /media/data/www. Obviously apache need access and everyone in the mydevs group needs access. But no one else save the normal system accounts. I jsut can seem to figure out the permissions wrangling to make it work.

help is appreciated.
Advertisement
Advertisement
  • Re: Gutsy+LAMP+New Webroot?

    Tue, October 23, 2007 - 1:40 PM
    It might help if you display the present permissions and partition layout (fstab), then we can actually see the perms and users as they are now. I'm a little confused by your intention though, please correct me if I'm wrong: you want to replicate /var/www permissions and add the additional perms for the mydev group (you don't specify what perms - rw-? rwx?)
    • Re: Gutsy+LAMP+New Webroot?

      Tue, October 23, 2007 - 5:55 PM
      Well depending on how it needs to be setup it would ideall look something like this....

      /media/data/www $1 $2 rwx-rwx----

      $1 = www-data OR user
      $2 = www-data OR mydev

      Basically i just need all files in the folder (sites) to be rwx by both apache2 and everyone in the mydev group. I did get it working for my user with the following

      drwxrwxrwx 5 root mydev .
      drwxr-xr-x 6 root root ..
      drwxrwxr-x 2 myuser mydev www

      but all the files i create are:

      -rw-r--r-- myuser myuser

      this dosent seem to bother apache any as its still loading my test index.html i havent tried anything more complex than that yet but ill be writing files here too on some projects via php.
      • Re: Gutsy+LAMP+New Webroot?

        Tue, October 23, 2007 - 10:32 PM
        Ok, I understand what you're looking for here. You want to grant multiple groups access to a single file (where a directory is also a file). Also, you want all files and directories (I assume) created with the default owner of the user that apache2 runs as. Correct me if I've misinterpreted you.

        The basic problem with this is that Unix perms are too primitive to allow you to do this by default. As a side note, I've seen many attempts to address this problem using some variation on script glue + umask (ugly), multiple group/user membership (uglier), and directory monitoring (ugliest). Don't bother with any those.

        The most elegant tool for this task would be Linux filesystem ACLs - they allow you to set multiple default owners and permissions along with the correct initial group owner. You didn't paste your fstab, so I don't know what filesystem types you have at your disposal. You can only use ACLs on ext3 and ReiserFS (I'm from BSD land, so maybe there are others that I haven't been exposed to... ).

        I don't have a Linux box handy so you'll want to review the appropriate man pages or consult google for all the possibilities. For your purposes, use the tool 'setfacl':

        Example:

        hostname# setfacl -m g:mydev:rwx /media/data/www

        This would set the additional permissions for group mydev (grants 'rwx' to the directory 'www')

        To force the proper group ownership of a created file, use the setgid bit. If you have issues finding a solution, feel free to post back here. It's a lot easier to help you troubleshoot if you post your command line + output: ls -d of your current www directory, the perms of the /media/data/www (without your modifications, i.e. the default state), your /etc/group file, your /etc/fstab (or similar), getfacl output, etc.

        Probably not all necessary, but I touch enough variety of systems that I occasionally forget what the defaults are from distro to distro.

        Hope this at least points you in the right direction!
        • Re: Gutsy+LAMP+New Webroot?

          Wed, October 24, 2007 - 6:04 AM
          Ahhh.. ACLs never even crossed my mind. I have them set up on my /mac and my Darwin box but didnt think of using them on this machine for some reason. More complex than i wanted to get but still definitely the simplest solution. Thanks for the tip. Ill consult the man pages and post back if i get stuck but i should be ok.

          Thanks again!
          • Re: Gutsy+LAMP+New Webroot?

            Wed, October 24, 2007 - 6:07 AM
            jsut for the record i am using ext3 on both my system and my data drives so hopefully this wont be an issue assuming there is an ACL daemon for linux which i have a hard time believing that there isnt.
            • Re: Gutsy+LAMP+New Webroot?

              Wed, October 24, 2007 - 7:57 AM
              awesome! =) Good luck!
              • Re: Gutsy+LAMP+New Webroot?

                Wed, October 24, 2007 - 3:14 PM
                Well libacl is part of the dist so it was jsut a matter of installing the tools via apt-get and then editing the fstab entry for the partition. After rmounting the drive i was happy to see that there is a GUI interface built in to Dolphin (im using kubuntu actually but ubuntu may have similar in support).

Recent topics in "System Administrators"

Topic Author Replies Last Post
Using PXE server to create and restore ghost images Unsubscribed 5 October 2, 2009
Phoenix OWASP July/August Meetings obnosis 0 July 2, 2009
Donations Sought: Time & Materials diana 0 April 1, 2008
Cheap NAS box 6 March 14, 2008