Changing File Permissions on NTFS Partitions in Linux

NTFS stands for New Technology File System and is developed by Microsoft for use on their Windows operating systems. NTFS is not normally used on Linux systems, but has been the default file system on Windows for many years. Linux users are probably used to seeing drives with the ext4 file system, which is ordinarily the default and certainly the most widespread in the Linux realm.

Although NTFS is a proprietary file system meant especially for Windows, Linux systems still have the ability to mount partitions and disks that have been formatted as NTFS. Thus a Linux user could read and write files to the partition as easily as they could with a more Linux-oriented file system. This may come in handy if you need to troubleshoot problems for a Windows-formatted disk, or if you recover a disk from a Windows machine and want to read its contents.

Even once an NTFS partition is successfully mounted on Linux, you will find that the Linux file permissions you are used to seeing do not work as expected. However, we can use Linux file permissions on an NTFS formatted hard drive when we use the correct options during the mount process. In this tutorial, you will see how to change the file permissions on an NTFS formatted drive in Linux.

In this tutorial you will learn:

  • How to mount an NTFS formatted drive in Linux
  • How to configure the correct mount options to allow Linux file permissions on NTFS
  • How to configure the /etc/fstab file for automatic NTFS partition mounting
Changing File Permissions on NTFS Partitions in Linux
Changing File Permissions on NTFS Partitions in Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to Install

Mount NTFS Drive With Linux Compatible File Permissions




The key to using Linux file permissions on an NTFS formatted partition is specifying the appropriate options during the mounting process. We will go through step by step instructions below in which we identify the NTFS partition we wish to mount, and edit the /etc/fstab file to mount our NTFS partition with Linux file permissions. Then, we can finish mounting the drive and use our familiar chmod Linux command to edit the file permissions in NTFS.

Installing ntfs-3g and fuse

Starting with Linux kernel version 5.15, there is native support for NTFS. In case this driver is not loaded on your Linux system, or you are using an older version, you can install the ntfs-3g and fuse packages to enable NTFS support on your system.

You can use the appropriate command below to install ntfs-3g and fuse with your system’s package manager.

To install ntfs-3g and fuse on Ubuntu, Debian, and Linux Mint:

$ sudo apt update
$ sudo apt install ntfs-3g fuse

To install ntfs-3g and fuse on Fedora, CentOS, AlmaLinux, and Red Hat:

$ sudo dnf install ntfs-3g fuse

To install ntfs-3g and fuse on Arch Linux and Manjaro:

$ sudo pacman -S ntfs-3g fuse


Mount NTFS Drive with Permissions step by step instructions

  1. In the examples below, our NTFS partition is accessible through /dev/sdb, and we will be mounting it to the /mnt/ntfs directory. Use the parted command if you need to identify the path through which your NTFS partition is accessed.
    $ sudo parted -l
    
    Our NTFS formatted partition can be identified by /dev/sdb in the parted output
    Our NTFS formatted partition can be identified by /dev/sdb in the parted output

    Then, create the path where you plan to mount the partition, if it hasn’t already been created.

    $ sudo mkdir -p /mnt/ntfs
    
  2. Next, we will identify the User ID uid and Group ID gid of our current user.
    $ id -u $USER
    1000
    $ id -g $USER
    1000
    

    Take note of this information, as it will be used as part of the mount options in the next steps.

    NOTE
    If you want default file permissions to be available for some user other than the current user, be sure to substitite their account name where we have used the $USER environment variable above.
  3. Now that we have identified the device path to our NTFS partition, and know where we wish to mount it, let’s use nano or your preferred text editor to open up the /etc/fstab file.
    $ sudo nano /etc/fstab
    
  4. Inside of this file, we will insert the following line:
    /dev/sdb  /mnt/ntfs  ntfs uid=1000,gid=1000,dmask=022,fmask=133 0 0
    

    This line tells the system that we want to mount the /dev/sdb partition to the /mnt/ntfs directory and that the partition should be mounted as ntfs. We specify our user’s uid and gid with the uid=1000 and gid=1000 command options, respectively. The dmask=022 option means that directories will have 755 permissions by default, and the fmask=133 option means that files will have 644 options by default.

    Mounting the NTFS partition with settings to enable Linux compatible file permissions
    Mounting the NTFS partition with settings to enable Linux compatible file permissions



  5. At this point, you can save changes and exit the file. To mount the file system as specified in the /etc/fstab file, use the following mount command:
    $ sudo mount -a
    

    You should now be able to navigate to your NTFS partition’s mount point and see that Linux file permissions have been applied to the files. Feel free to change the dmask and fmask settings as you see fit, in case you would like some other default permissions applied to the files on your NTFS partition.

Closing Thoughts

In this tutorial, we saw how to change file permissions on an NTFS formatted drive on a Linux system. The process involved mounting the NTFS drive with the correct options so that Linux compatible file permissions could be applied to the data on the partition. From that point, the chmod and other pertinent permission commands can be used on the partition.



Comments and Discussions
Linux Forum