HowTo Mount NTFS Partitions Read Write in Ubuntu & Kubuntu

Versions: tested in 9.04.

FYI there is a sister tutorial on this site for mounting FAT & FAT32 / Vfat partitions with read write access.

↑↑↑↑Permissions and Ownership on NTFS Partitions

The NTFS filesystem does not support Linux permissions or ownership per se. You can't successfully change ownership with the Linux command chown and you can't successfully change permissions with the Linux command chmod. Ownership and permissions are set only in the mount command.

The permissions and ownership properties that are available for NTFS under Linux are not written into the individual files to be retained when the filesystem is unmounted or the computer is turned off. Permissions and ownership obtained under Linux are temporary artifices imposed via the mount command and maintained temporarily by the operating system. They are transient properties that last only until the NTFS partition is unmounted.

↑↑↑↑Identifying your Partitions

Two key identifiers in Ubuntu / Kubuntu for hard drive partitions are the device name (e.g. sda1) and the UUID (Universally Unique Identifier). You can list the attributes of your partitions and see the the various device names and UUIDs with this command entered in a terminal window:

sudo blkid -L

Here's a typical return you get from that command. This hard drive has two NTFS partitions on sda1 and sda2, a fat32 (vfat) partition on sda3 and Ubuntu on sda5:

device fs_type label mount point UUID ------------------------------------------------------------------------------------------- /dev/sda1 ntfs (not mounted) F028603828600048 /dev/sda2 ntfs (not mounted) 7810409A104060EC /dev/sda3 vfat (not mounted) AD74-85CA /dev/sda5 ext3 / 509dc0a6-d1b4-4489-9978-61dbe279efcf

We'll focus in this tutorial on the NTFS partition sad1 with UUID F028603828600048. Note the 16 character alphanumeric string of the UUID for NTFS partitions.

↑↑↑↑Mounting NTFS Partitions Temporarily (from the command line)

First you must create a directory where the partition will be mounted. This is called the mount point. For example, we'll use the directory "mount_point" located at /path_to/mount_point. It doesn't matter who owns the directory or what the permissions on it are before the mount is created, because these are automagically replaced (in the moment of mounting) by ownerships and permissions contained in (or implied in) the mount command.

Second you must know the details of your NTFS partition. Use the sudo blkid command to look at your disks. In our example we have /dev/sda1 with F028603828600048.

Then you can use this mount command to make the partition writeable for all users:

mount -t ntfs-3g /dev/sda1 /path_to/mount_point

When you execute the mount, the mount point automagically assumes these properties: user = root, group = root and permissions = drwxrwxrwx.

If you prefer the partition to belong to a particular user, e.g. suzette with UID=1000 and GID=1000, then use this version:

mount -t ntfs-3g -o uid=1000,gid=1000,umask=0022 /dev/sda2 /path_to/mount_point

[If you want to find a user's UID & GID, run the terminal command: id suzette]

For this case, the mount point automagically assumes the properties: user = suzette, group = suzette and permissions = drwxr-xr-x in the standard style of an Ubuntu user's folder. The mount is writeable only by suzette and readable by everyone. If you change the option to umask=0027, the permissions become drwxr-x--- and only suzette can read the mount's contents.

FYI using the UUID: You can use the UUID to mount partitions from the command line. In the examples above you simply replace the device path /dev/sda1 by the uuid option: -U F028603828600048 and the device will mount. I hardly ever use it, too fiddly. You can't use the UUID in the umount command (use sudo umount /dev/sda1).

↑↑↑↑Mounting NTFS Partitions Permanently (with an entry in fstab)

The file system table is a text file called fstab, located at /etc/fstab. It contains a list of partitions and mount commands that are read and executed at boot time. If you have a partition that you wish to have mounted permanently, you can put a line to that effect in the file fstab.

The file is a text file. You can open it for editing with this command in a terminal window:

gksu gedit /etc/fstab

Continuing with our example of device sda1 with UUID F028603828600048, you can write mounts by putting lines like the ones below into fstab. [Tip: be sure to leave a blank line as the last line in fstab]. Once you've made the edit you can make the mount effective by rebooting or by running this command: sudo mount -a.

Use this to mount the partition writeable by all users (The mount point will have ownership root:root and permissions drwxrwxrwx):

UUID=F028603828600048     /path_to/mount_point     ntfs-3g     defaults     0 0

Use this to mount the partition writeable by one user, e.g. suzette and readable by all other users (the mount point will have ownership suzette:suzette and permissions drwxr-xr-x):

UUID=F028603828600048     /path_to/mount_point     ntfs-3g     uid=1000,gid=1000,umask=0022     0 0

If you want suzette to be the only ordinary user to have access to the partition, use the option umask=0027. This will prevent others from having read access or write access.

FYI using the device name: you may use the device path instead of the UUID in the mounts in fstab. Just replace the portion UUID=F028603828600048 with the device path /dev/sda1. I recommend against doing this because the partition can change from position sda1, and if it does then the mount fail, whereas the UUID will never change.

↑↑↑↑Automounts for USB drives

If you plug a USB drive in it will automount writeable by the user who is active at that time. All files and directories become owned by the mounting user and the group becomes "root". Directories temporarily become drwxrwxrwx and files temporarily become rwxrwxrwx. If you have a more permanent arrangement in mind, have a look at the section above.

Appendix: umask table

You may adjust adjust the folder, document or user permissions quite widely. You should read the man pages. Check out the umask, dmask and fmask options. Here's a handy little table of octal permissions to use for directory permissions:

  • owner=rwx group=rwx other=rwx; i.e for drwxrwxrwx use umask=0000
  • owner=rwx group=rwx other=r-x; i.e for drwxrwxr-x use umask=0002
  • owner=rwx group=rwx other=---; i.e for drwxrwx--- use umask=0007
  • owner=rwx group=r-x other=r-x; i.e for drwxr-xr-x use umask=0022
  • owner=rwx group=--- other=---; i.e for drwxr-x--- use umask=0027
  • owner=rwx group=--- other=---; i.e for drwx------ use umask=0077


That's all folks.
Swerdna, August 19 2009