Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: HOWTO: Mount NTFS partitions with specific ownership/permissions

  1. #1
    Join Date
    Apr 2010
    Location
    England
    Beans
    3,286

    HOWTO: Mount NTFS partitions with specific ownership/permissions

    Hello there. If you're reading this then you're probably trying to get around the fact that NTFS partitions don't support Linux file permissions. This tutorial will, hopefully, show you how to get around this little problem. Fortunately for you, this only involves editing a single file. Easy, eh?

    The file in question is located at /etc/fstab. This file contains a list of partitions which you want mounted, one partition per line. Now, if you take a look at this file, you'll see that there are several lines already. DO NOT EDIT THESE LINES. They are important. Editing them, even slightly, may cause your system to stop booting.

    If you take a look at this file, you'll see that there are several columns of information. Assuming that you haven't already created one, you'll need to add a new line for your NTFS partition. To know what to put as the information for the partition, we'll need to know a few things about it. Once you have all the information, you can edit fstab by running
    Code:
    gksu gedit /etc/fstab
    • Firstly: which partition is it?
      In this case, this needs to be a device node identifier. e.g. /dev/sda1, a partition UUID, or a partition label. Running
      Code:
      sudo blkid -c /dev/null
      in a terminal will tell you all the relevant information about your partitions. Hopefully you can determine from this list which one is the correct partition.

      If you use a UUID or Label, you need to declare it as such. e.g. "LABEL=Windows", "UUID=ABCDEFGHIJKLKLMNOP".
    • Next, where should it be mounted?
      This part is simple: where do you want the partition to be accessible from? Ubuntu mounts partitions in /media by default, so if you want the partition to be mounted there, say so. e.g. "/media/Windows". You will need to manually create this folder since fstab will complain if it's not there, so make sure that the folder isn't being used already, and run
      Code:
      sudo mkdir /media/Windows
    • Next, which filesystem should it be mounted as?
      Since we're mounting an ntfs partition, specify "ntfs-3g" for this column. Don't use "ntfs" unless you don't want to be able to write to the partition after it's mounted (by write, I mean making new files, editing files, moving files and folders, etc.; the "ntfs" driver is outdated and only lets you read files.)
    • Next, what options should it be mounted with?
      This is the most important column in this case, this is where you specify permissions. How you do this isn't immediately obvious, but there's a way, and it's actually rather simple.

      This is a comma separated list, so don't use spaces or tabs, or else you'll find that the mount line doesn't work as expected. To specify the permissions, you merely need to declare three things: UID, GID, and umask.
      • uid=#### specifies which userid should own the files on the partition. e.g. "uid=1000" means that the user with the id "1000" should own the files. You can find out your UID by opening a terminal and running "echo $UID".
      • gid=#### specified which groupid should own the files on the partition. e.g. "gid=1000" means that the group with the id "1000" should own the files. Finding out groupids is slightly more difficult than finding out your userid because you can belong to several groups at the same time. Now, Ubuntu normally creates a group for every user, with the same ID as the UID, so you can probably use your UID as the GID. However, you can get a list of groups by running, in a terminal, "cat /etc/group". This will display a list with upto four colon-separated fields per line. The lines will contain the following items: name, an encrypted password, the GID, and a list of users in the group. Find the group you want to use, and add it's GID to the options.
      • umask=UGO is the most important of the three options; it specifies what the permissions will be for the user, the group, and everyone else. The numbers used here need to be between 0 and 7, anything else will probably cause an error. These numbers are actually an inverse of normal permissions, so while "7" means "read, write, and execute" in normal permission setting, in fstab "7" means "no permissions". Setting "umask=000" will give EVERYONE read, write, and execute permissions. For clarification, the U is the permissions for the user, G is for group, and O is for others. See this for more details about umask.


      You may also add other things to this list. Generally speaking, it's best to start with the "defaults" option. "auto" makes the partition mount automatically when you boot up. Read more here: http://www.tuxfiles.org/linuxhelp/fstab.html
    • The final two columns should be "0" and "0".
      These two columns are only used for Linux filesystems, so setting them to 0 stops any complications from arising.

    A finished fstab line may look like:
    Code:
    UUID=ABCDEFGHIJKLKLMNOP /media/Windows ntfs-3g defaults,auto,uid=1000,gid=1000,umask=002 0 0
    another example:
    Code:
    /dev/sdb5 /mnt/Music ntfs-3g defaults,uid=1002,gid=1500,umask=227 0 0
    The next time you boot up, or the next time you run "sudo mount -a", the partition should be mounted where you want it, with the permissions you want it to have.

    Enjoy.
    Last edited by WorMzy; November 20th, 2011 at 06:32 PM.
    http://xkcd.com/293/
    There are 10 kinds of people in this world: Those who understand ternary, those who don't, and those who confuse it with binary.

  2. #2
    Join Date
    Apr 2011
    Location
    Punjab, India
    Beans
    20
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    Nice How To friend, helped me a lot.

  3. #3
    Join Date
    Nov 2010
    Beans
    271
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    Nice.
    Last edited by debd; May 28th, 2011 at 07:46 PM.

  4. #4
    Join Date
    Nov 2010
    Location
    Kerala
    Beans
    376
    Distro
    Ubuntu

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    If have two more ntfs partitions how to mount all .here is my whole file.csmct is the limted user I want to give the permission for accessing those ntfs drives without credential of admin power
    Attached Images Attached Images
    Last edited by Rakeshvijayan; June 27th, 2011 at 09:39 AM.

  5. #5
    Join Date
    Nov 2010
    Location
    Kerala
    Beans
    376
    Distro
    Ubuntu

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    another file
    Attached Images Attached Images

  6. #6
    Join Date
    Nov 2010
    Location
    Kerala
    Beans
    376
    Distro
    Ubuntu

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    solved
    Attached Images Attached Images

  7. #7
    Join Date
    Apr 2008
    Beans
    45

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    Nice. Very helpful tutorial. Worked perfectly.

    In a future version of this HOW TO, please consider including a brief explanation of several common UMASK value options, or include a link to more information.

  8. #8
    Join Date
    Apr 2010
    Location
    England
    Beans
    3,286

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    Thanks for the feedback. I've added an informative link to that section which should help people who want to understand umask values.
    http://xkcd.com/293/
    There are 10 kinds of people in this world: Those who understand ternary, those who don't, and those who confuse it with binary.

  9. #9
    Join Date
    Jan 2010
    Beans
    93
    Distro
    Ubuntu

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    great tutorial

  10. #10
    Join Date
    Feb 2006
    Location
    South Eastern US
    Beans
    20
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: Mount NTFS partitions with specific ownership/permissions

    Excellent, exactly what I have been looking for. Thanks

Page 1 of 3 123 LastLast

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
  •