Issues with NTFS when using systemd to mount filesystem

Linked to:

I used this Method to mount a ext4 and an NTFS drive pretty much the same way, only difference in Filesystem. However the NTFS drive giving me issues, for example some tools don’t seem to be able to write on this drive (guess because it is mounted as root).

So i checked the drive with “stat” and i would get

Access: (0777/drwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)

While my ext4 drive (that works) prints out

Access: (0755/drwxr-xr-x)  Uid: ( 1000/    Maracuja)   Gid: ( 1001/    Maracuja)

Any Idea what i can do about that? I already tried

sudo chown $USER:$USER path/to/drive -R

Though that didn’t do do anything

ntfs is a reverse engineered foreign filesystem - and linux only supports reading and writing oob - using the ntfs-3g driver.

While there is kernel support for the file system developed by Paragon Software - ntfs3 - the inclusion in kernel seem to be more a media stunt - as the developer has been unreachable since.

Mounting a partition formatted with ntfs will always be mount rw - no matter the permissions on the mountpoint - you don’t have to specify anything.

Example

 $ ls -l /mnt/ntfs-ro
total 8
drwxr-xr-x 2 root root 4096  3 sep 09:38 ntfs-ro
 $ sudo mount /dev/sdg1 /mnt/ntfs-ro

 $ lsblk -f
NAME   FSTYPE FSVER LABEL          UUID                    FSAVAIL FSUSE% MOUNTPOINTS
[...]
sdg                                                                                         
└─sdg1 ntfs         samsung750ntfs 5337D78206CA8C03 421,7G    40% /mnt/ntfs-ro
[...]

Mounted

 $ ls -l /mnt
total 8
drwxrwxrwx 1 root root 4096 31 aug 08:38 ntfs-ro

09:50:29 ○ [fh@tiger] /mnt/ntfs-ro
 $ ls -l
total 8
drwxrwxrwx 1 root root 4096 31 aug 08:38 private
drwxrwxrwx 1 root root 4096 31 aug 08:38 software

09:50:33 ○ [fh@tiger] /mnt/ntfs-ro
 $ mkdir ntfs-ro-test
mkdir: created directory 'ntfs-ro-test'

09:50:45 ○ [fh@tiger] /mnt/ntfs-ro
 $ ls -l
total 8
drwxrwxrwx 1 root root    0  3 sep 09:50 ntfs-ro-test
drwxrwxrwx 1 root root 4096 31 aug 08:38 private
drwxrwxrwx 1 root root 4096 31 aug 08:38 software

09:50:49 ○ [fh@tiger] /mnt/ntfs-ro
 $ whoami
fh

09:53:38 ○ [fh@tiger] /mnt/ntfs-ro
 $ echo 'this is a test for rootmounted ntfs formatted device' > ntfs-ro-test.txt

09:53:42 ○ [fh@tiger] /mnt/ntfs-ro
 $ cat ntfs
ntfs-ro-test/     ntfs-ro-test.txt

09:53:42 ○ [fh@tiger] /mnt/ntfs-ro
 $ cat ntfs-ro-test.txt
this is a test for rootmounted ntfs formatted device

If you’re going to be using either systemd-mount units or a /etc/fstab record for an NTFS volume, then you should include the necessary mount options for setting the UID and GID to those of the user account you want to give full access to, i.e. UID=1000 and GID=1001.

NTFS does not store any POSIX file ownership or permissions, so they need to be emulated at mount time.

2 Likes

For the kernel ntfs3 driver - posix acl is only active when specifically mount with acl option

https://docs.kernel.org/filesystems/ntfs3.html

ntfs has a generally weird behavior on Linux as can be deducted from below sequence

some output truncated ([…]) to increase readability

 $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
[...]
sdd           8:48   0 698,6G  0 disk 
└─sdd1        8:49   0 698,6G  0 part 
[...]

 $ sudo mount -t ntfs3 /dev/sdd1 /mnt/ntfs-ro

 $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
[...]
sdd           8:48   0 698,6G  0 disk 
└─sdd1        8:49   0 698,6G  0 part /mnt/ntfs-ro
[...]

 $ cd /mnt/

 $ ls -l
total 8
drwxrwxrwx 1 root root 4096  3 sep 09:53 ntfs-ro
drwxr-xr-x 2 root root 4096  3 sep 09:38 ntfs-rw

 $ lsblk -f
NAME        FSTYPE      FSVER LABEL          UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
[...]
sdd                                                                                              
└─sdd1      ntfs              samsung750ntfs 5337D78206CA8C03                      421,7G    40% /mnt/ntfs-ro
[...]

 $ ls
ntfs-ro  ntfs-rw

 $ cd ntfs-ro
/mnt/ntfs-ro

 $ ls
ntfs-ro-test  ntfs-ro-test.txt  private  software

 $ rm -r ntfs
ntfs-ro-test/     ntfs-ro-test.txt  

 $ rm -r ntfs-ro-test
rm: remove write-protected directory 'ntfs-ro-test'? y

 $ ls -l
total 8
-rwxr-xr-x 1 root root   53  3 sep 09:53 ntfs-ro-test.txt
drwxr-xr-x 1 root root 4096 31 aug 08:38 private
drwxr-xr-x 1 root root 4096 31 aug 08:38 software

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.