Results 1 to 6 of 6

Thread: fstab - make default file permission 755

  1. #1
    Join Date
    Dec 2010
    Location
    Islamabad, Pakistan
    Beans
    70
    Distro
    Ubuntu 13.04 Raring Ringtail

    Lightbulb fstab - make default file permission 755

    Hi, this is pretty basic stuff and I feel like I should know it already.

    I use /etc/fstab to automount ntfs partitions at boot. The pattern I use:

    Code:
    # <uuid> <mount-point> <fs-type> <options> <dump> <pass>
    UUID="THEUUID0123456789" /media/Data ntfs defaults 0 0
    It works! But when in terminal, I do ls /media/, the directory "Data" has a green background. I'm not sure what that indicates, but I have a hunch that it depends on permissions (or ownership?) If I do stat -c "%a" /media/Data, I get 777.
    I want default permissions to be 755 or 775. However, that poses a problem because the owner of /media/Data (and its subdirs) is root, and if permission is not 777, I'll have to login as root whenever doing any modifications to the mounted fs. Is it possible to automount with owner=me and permission 755.

    In short, I want to remove the annoying green background behind directory name without losing access to /media/Data (and its subdirs) from a non-root user. Is that possible? If yes, how?
    (Is it through the "options" argument in fstab?)

  2. #2
    Join Date
    Sep 2013
    Beans
    16
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: fstab - make default file permission 755

    Yes, your hunch is correct as this is caused by adding 777 perms to a directory.

    To answer the second part of your question, yes you can mount it by user so that not root but you are the owner.
    UUID="THEUUID0123456789" /media/Data defaults,uid=1000,rw 0 0

    (In this case, you would be uid 1000. You can change this as needed, and can add a gid as well)

  3. #3
    Join Date
    Aug 2007
    Location
    US
    Beans
    929
    Distro
    Ubuntu Development Release

    Re: fstab - make default file permission 755

    try this instead:

    Code:
    UUID="THEUUID0123456789" /media/Data ntfs auto,uid=1000,gid=1000,umask=0022 0 0
    umask[1] is actually used as the inverse or the permissions you're looking for. umask=0022 mounts with permissions 0755 or -rwxr-xr-x

    fmask is another useful option, but for files only. dmask is the same but for directories only. umask controls both that's why we use it.

    [1] https://wiki.archlinux.org/index.php/NTFS-3G
    Please mark completed threads as [SOLVED], which lets us find solutions faster!

  4. #4
    Join Date
    Dec 2010
    Location
    Islamabad, Pakistan
    Beans
    70
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: fstab - make default file permission 755

    Thank you. I'm marking this solved.
    I have not yet tested this, though your explanations and references to docs are sufficient, I think. Is there a way to test /etc/fstab without rebooting?

    Off-topic questions:
    @spacesamurai2: I understand that uid is "User ID", but what is gid?
    @ptn107: I like umask. But would rw give 777 permission or everything? Or should it change the permissions now that uid is defined?

  5. #5
    Join Date
    Sep 2007
    Location
    Oklahoma, USA
    Beans
    2,357
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: fstab - make default file permission 755

    You can "sudo mount -a" to remount without rebooting. It's the standard way to test changes to /etc/fstab, since if it fails the system is still up so you can fix things; a reboot could leave you out in the cold and having to do things with a Live CD and chroot to bet it going again.

    The "gid" is Group ID.

    No, the "rw" and default permissions are separate although they do interact. If a device is mounted "ro" then giving write permissions won't override the read-only attribute, and if it's "rw" you can still have groups or "others" forbidden to write.
    Last edited by JKyleOKC; September 24th, 2013 at 09:08 PM. Reason: added explanation
    --
    Jim Kyle in Oklahoma, USA
    Linux Counter #259718
    Howto mark thread: https://wiki.ubuntu.com/UnansweredPo.../SolvedThreads

  6. #6
    Join Date
    Sep 2013
    Beans
    16
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: fstab - make default file permission 755

    Glad you found the answer you are looking for

    GID stands for Groud ID. Checkout /etc/group for a list.

    As for testing fstab, you can always run "sudo mountall" and it should pickup the entires.

Tags for this Thread

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
  •