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/fstabfile for automatic NTFS partition mounting
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – 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/fstabfile to mount our NTFS partition with Linux file permissions. Then, we can finish mounting the drive and use our familiar
chmodLinux 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
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.
$ sudo apt update $ sudo apt install ntfs-3g fuse
$ sudo dnf install ntfs-3g fuse
$ sudo pacman -S ntfs-3g fuse
Mount NTFS Drive with Permissions step by step instructions
- In the examples below, our NTFS partition is accessible through
/dev/sdb, and we will be mounting it to the
/mnt/ntfsdirectory. Use the
partedcommand if you need to identify the path through which your NTFS partition is accessed.
$ sudo parted -l
Then, create the path where you plan to mount the partition, if it hasn’t already been created.
$ sudo mkdir -p /mnt/ntfs
- Next, we will identify the User ID
uidand Group ID
gidof 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.
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
$USERenvironment variable above.
- 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
$ sudo nano /etc/fstab
- 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/sdbpartition to the
/mnt/ntfsdirectory and that the partition should be mounted as
ntfs. We specify our user’s uid and gid with the
gid=1000command options, respectively. The
dmask=022option means that directories will have
755permissions by default, and the
fmask=133option means that files will have
644options by default.
- At this point, you can save changes and exit the file. To mount the file system as specified in the
/etc/fstabfile, use the following
$ 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
fmasksettings as you see fit, in case you would like some other default permissions applied to the files on your NTFS partition.
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.