Results 1 to 7 of 7

Thread: Best practice /etc/fstab mount

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Beans
    23

    Lightbulb Best practice /etc/fstab mount

    Hi!!I've one question for you..

    I need to mount some EXT4 partitions automatically on boot through fstab file. The mountpoints are /mnt/<name> etc etc. I want to give writing permission to some users and groups with something like 775(I will choose later).

    So here is the problem... what's the best practice??


    1. Create the folders in /mnt and give them the right permissions, like 775 and user:group owner. I must preserve this scheme for all the files that will be written, it is no good if a program run by an user will write stuff with different permissions.
    2. Create the folders in /mnt as root, so with 755 and root:root owner and add some mount options in fstab file. As said before, I must preserve permissions for all the files within.



    Thanks!
    Last edited by supermario87; November 6th, 2012 at 05:54 PM.

  2. #2
    Join Date
    May 2006
    Location
    Milwaukee,WI
    Beans
    6,098
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Best practice /etc/fstab mount

    what filesystem are the partitions?
    Check out my Blog about my life and computer software and hardware. http://ubuntuaddicted.blogspot.com/
    My YouTube channel:
    http://www.youtube.com/ubuntuaddicted

  3. #3
    Join Date
    Oct 2005
    Location
    INDY
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Best practice /etc/fstab mount

    This will give you the basics, should be easy to figure out from there.
    https://help.ubuntu.com/community/Fstab
    Castles Made of Sand,
    Fall in the Sea,
    Eventually!

  4. #4
    Join Date
    Nov 2007
    Location
    NC, USA
    Beans
    829
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Best practice /etc/fstab mount

    You can use the "uid" and "gid" options in the fstab.

    Example:

    Code:
    /dev/sdc1 /mnt/share ext4 rw,uid=1000,gid=1000 0 0
    Just substitute the correct uid or gid for the given user.
    Linux User #460341 || Ubuntu User #19510 || Unanswered Posts Team

  5. #5
    Join Date
    Mar 2010
    Beans
    23

    Re: Best practice /etc/fstab mount

    Partitions will be ext4.

  6. #6
    Join Date
    Mar 2010
    Beans
    23

    Re: Best practice /etc/fstab mount

    Quote Originally Posted by PinkFloyd102489 View Post
    You can use the "uid" and "gid" options in the fstab.

    Example:

    Code:
    /dev/sdc1 /mnt/share ext4 rw,uid=1000,gid=1000 0 0
    Just substitute the correct uid or gid for the given user.
    I think that ext4 FS does not support uid and gid options!
    Last edited by supermario87; November 6th, 2012 at 06:50 PM.

  7. #7
    Join Date
    Oct 2008
    Location
    Ottawa, Canada
    Beans
    801
    Distro
    Xubuntu 12.10 Quantal Quetzal

    Re: Best practice /etc/fstab mount

    The proper permissions should be set in each partitions root directory, not on the mount points (your #1).

    You are right to say ext4 does not support fstab-derived UIDs. It's all done at the fs level.

    Ubuntu's umask is 0002 so all apps should create 775 files with the current user:group as owner, unless the app is misbehaved.

    Your best bet would be to set the SGID bit for your directories in your individual partitions. It will force all new files to acquire the group that owns the directory.
    Code:
    sudo chmod g+s -R /mnt/<name>
    You could also go with a more user-centric approach with ACLs (access control lists).
    Set default directory ACLs and also add them to existing files, independent of ownership.
    Code:
    sudo setfacl -R -d -m <user>:rwX /mnt/<name>
    sudo setfacl -R -m <user>:rwX /mnt/<name>
    Good luck!
    Last edited by LewisTM; November 6th, 2012 at 08:31 PM.
    husband@wife$ make sandwich
    Permission denied
    husband@wife$ sudo make sandwich

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •