2

Why I cannot change the ownership on mounting ntfs drive?

I give uid=1000,gid=1000, etc in my /etc/fstab file, but found it is not working. So I'm testing it out on command line:

root@host:~# mount | grep /mnt/tmp1 | wc
      0       0       0

root@host:~# mount -o uid=1000 /dev/nvme0n1p4 /mnt/tmp1/

root@host:~# mount | grep /mnt/tmp1
/dev/nvme0n1p4 on /mnt/tmp1 type fuseblk (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)

root@host:~# umount /mnt/tmp1

root@host:~# mount -o user_id=1000 /dev/nvme0n1p4 /mnt/tmp1/

root@host:~# mount | grep /mnt/tmp1
/dev/nvme0n1p4 on /mnt/tmp1 type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 21.10
Release:        21.10
Codename:       impish

$ apt-cache policy mount
mount:
  Installed: 2.36.1-8ubuntu1
  Candidate: 2.36.1-8ubuntu2
  Version table:
     2.36.1-8ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu impish-updates/main amd64 Packages
 *** 2.36.1-8ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu impish/main amd64 Packages
        100 /var/lib/dpkg/status

Am I missing something?
Why I cannot change the ownership on mounting ntfs drive?

0

2 Answers 2

3

You're using NTFS-3g, a user-space NTFS filesystem driver.

Between the kernel and any such user-space filesystem drivers, there is an interface layer called FUSE (short of Filesystem in USErspace).

Note that the filesystem type is listed as fuseblk, not as ntfs or ntfs-3g. When you see type fuseblk (some options), then the options within parentheses are FUSE options, not actual filesystem options. See man 8 fuse if you want to know more details.

Specifically, the user_id=0 means "this FUSE filesystem was mounted by root" and nothing else. The actual mount options are handed to the filesystem driver process, which can do whatever it wants with them. (FUSE allows only the user that mounted the filesystem to access it, unless the FUSE option allow_other is specified.)

Unfortunately the FUSE interface layer does not allow showing the actual mount options of the FUSE-based filesystem in the mount command output the same way as classic kernel-based filesystems show them.

Instead, if you run pgrep -a ntfs-3g, you will see the ntfs-3g filesystem driver processes and their command-line options, which will include the mount options you specified.

For example, on my system, I have these lines in /etc/fstab:

UUID="A268B5B668B599AD" /win/c          ntfs-3g defaults,windows_names,inherit,nofail   0   0
UUID="56A31D4569A3B7B7" /win/d          ntfs-3g defaults,windows_names,inherit,nofail   0   0

And so, I'll see these processes:

$ pgrep -a ntfs-3g
775 /sbin/mount.ntfs-3g /dev/nvme0n1p3 /win/c -o rw,windows_names,inherit
1008 /sbin/mount.ntfs-3g /dev/sdb2 /win/d -o rw,windows_names,inherit
1

Here's my FSTAB entry. Note the exec option:

UUID=66D6934FD6931DFD /mnt/SeagateExpansionDrive ntfs-3g auto,users,permissions,exec,x-gvfs-show 0 0

With the above I can chown, chmod, and exec shell scripts. I'm running Ubuntu.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .