Changing file permissions after mounting with fstab

1

I want to mount a drive with following default permissions:

  • files: -rw-r--r--
  • folders: drwxr-xr-x
  • owned by default user/group (1000)

Which lead me to this fstab entry:

UUID=XXX /media/drive ntfs auto,nofail,noatime,fmask=133,dmask=022,uid=1000,gid=1000 0 0

With these options however, I can't change any file permissions. Like allow execution of a file.

How would I do that?

Chayze

Posted 2019-04-04T15:52:10.643

Reputation: 58

Answers

0

With the options you have specified, the permissions are applied to every file in the NTFS file system.

To take advantage of ntfs-3g's feature for permissions per file, you need to add the permissions option. If you also want to support more than one user, you can use the usermapping option.

From man 8 mount.ntfs:

Access Handling and Security

By default, files and directories are owned by the effective user and group of the mounting process, and everybody has full read, write, execution and directory browsing permissions. You can also assign permissions to a single user by using the uid and/or the gid options together with the umask, or fmask and dmask options.

Doing so, Windows users have full access to the files created by ntfs-3g.

But, by setting the permissions option, you can benefit from the full ownership and permissions features as defined by POSIX. Moreover, by defining a Windows-to-Linux user mapping, the ownerships and permissions are even applied to Windows users and conversely.

(emphasis mine)

Here is the documentation on the pertinent options:

usermapping=file-name
Use file file-name as the user mapping file instead of the default .NTFS-3G/UserMapping. If file-name defines a full path, the file must be located on a partition previously mounted. If it defines a relative path, it is interpreted relative to the root of NTFS partition being mounted. When a user mapping file is defined, the options uid=, gid=, umask=, fmask=, dmask= and silent are ignored.

permissions
Set standard permissions on created files and use standard access control. This option is set by default when a user mapping file is present.

Deltik

Posted 2019-04-04T15:52:10.643

Reputation: 16 807

After looking into ntfs-3g I found out, that extending the in fstab configured file permissions is not possible. You can only restrict them even further. That means I allow execution for each file or none. Very unsatisfactory – Chayze – 2019-04-04T18:48:20.180