Can't set NTFS masks in /etc/fstab

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
yuuki47
Level 1
Level 1
Posts: 9
Joined: Mon Jul 05, 2021 11:34 am

Can't set NTFS masks in /etc/fstab

Post by yuuki47 »

Hi,

I moved from Zorin OS to Linux Mint after one year from using it (I had stability issues on Zorin) and everything has been mostly alright so far, except dealing with NTFS filesystems.

I have three hard drives with important files on them (None of them have Windows installations) and I noticed that whenever I would transfer text files/scripts out of the drive, Mint would ask me if I want to execute or display them which I found quite odd. I did a lot of research online and found out that this hole digs quite deep, so I ended up learning about masks in /etc/fstab and permissions which was interesting actually but... I'm quite confused because I didn't have to bother with this on Zorin. (I use the same fstab file btw.)

From what I learned, my best option would be to mask out the executable permissions from files so this wouldn't happen, but after experimenting for an entire hour, it dawned on me that fmasks and dmasks have absolutely no effect.

Here is one of my hard drives in /etc/fstab (The one I was experimenting with):

Code: Select all

UUID=CA26D6FA26D6E68B /home/hatsumemio/HDDs/DataXT ntfs-3g auto,user,dmask=0070.fmask=0170 0 1
I carefully made the masks (I'm still literally one hour new at this) but it seems to have zero effect as proven here:

Code: Select all

hatsumemio@mintpc:~/HDDs/DataXT$ ls -l
total 1189408
drwx---rwx 1 root root          0 Sep 24 16:06 '$RECYCLE.BIN'
drwx---rwx 1 root root       4096 Jun 29 22:25  Archives
-rwxrwxrwx 1 root root 1217947648 Apr 24 00:39  kanon.iso
-rwxrwxrwx 1 root root          0 Oct 22 14:10 'Untitled Document'
If I understand right, -rwxrwxrwx would equal to 0000 in the file mask which is clearly not what I set it to. Why is that?

To further prove this, I set the mask to 0011 to see if permissions would change, but they did not:

Code: Select all

root@mintpc:/home/hatsumemio/HDDs# cat /etc/fstab
UUID=6F8E-A862  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

#HARD DRIVE AUTO-MOUNT
UUID=0FE8084D0FE8084D /home/hatsumemio/HDDs/Data3 ntfs-3g auto,user,rw 0 1
UUID=CA26D6FA26D6E68B /home/hatsumemio/HDDs/DataXT ntfs-3g auto,user,dmask=0070.fmask=0011 0 1
UUID=3644C65E44C6210B /home/hatsumemio/HDDs/DataA ntfs-3g auto,user,rw 0 1
#UUID=35569258560F4A9F /home/hatsumemio/HDDs/DataSSD2 ntfs-3g auto,user,rw 0 1
#UUID=4344D31C3D562116 /home/hatsumemio/HDDs/DataSSD ntfs-3g auto,user,rw 0 1
root@mintpc:/home/hatsumemio/HDDs# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0   1.8T  0 disk 
├─sda1        8:1    0    16M  0 part 
└─sda2        8:2    0   1.8T  0 part /home/hatsumemio/HDDs/DataA
sdb           8:16   0 931.5G  0 disk 
├─sdb1        8:17   0 430.8G  0 part /home/hatsumemio/HDDs/DataXT
└─sdb2        8:18   0 500.8G  0 part /home/hatsumemio/HDDs/Data3
sdc           8:32   1  28.7G  0 disk /media/hatsumemio/18C9-FBF2
sr0          11:0    1  1024M  0 rom  
nvme0n1     259:0    0 447.1G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
└─nvme0n1p2 259:2    0 446.6G  0 part /
root@mintpc:/home/hatsumemio/HDDs# umount /dev/sdb1
root@mintpc:/home/hatsumemio/HDDs# mount /dev/sdb1
root@mintpc:/home/hatsumemio/HDDs# ls -l DataXT/
total 1189408
drwx---rwx 1 root root          0 Sep 24 16:06 '$RECYCLE.BIN'
drwx---rwx 1 root root       4096 Jun 29 22:25  Archives
-rwxrwxrwx 1 root root 1217947648 Apr 24 00:39  kanon.iso
-rwxrwxrwx 1 root root          0 Oct 22 14:10 'Untitled Document'
-rwxrwxrwx 1 root root          0 Oct 22 15:39 'Untitled Document 2'
As you can see, there is aboslutely no change. I wondered if maybe the file is being cached, so I tried removing the drive altogether in fstab just to see what happens:

Code: Select all

root@mintpc:/home/hatsumemio/HDDs# cat /etc/fstab
UUID=6F8E-A862  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

#HARD DRIVE AUTO-MOUNT
UUID=0FE8084D0FE8084D /home/hatsumemio/HDDs/Data3 ntfs-3g auto,user,rw 0 1
#UUID=CA26D6FA26D6E68B /home/hatsumemio/HDDs/DataXT ntfs-3g auto,user,dmask=0070.fmask=0011 0 1
UUID=3644C65E44C6210B /home/hatsumemio/HDDs/DataA ntfs-3g auto,user,rw 0 1
#UUID=35569258560F4A9F /home/hatsumemio/HDDs/DataSSD2 ntfs-3g auto,user,rw 0 1
#UUID=4344D31C3D562116 /home/hatsumemio/HDDs/DataSSD ntfs-3g auto,user,rw 0 1
root@mintpc:/home/hatsumemio/HDDs# umount /dev/sdb1
root@mintpc:/home/hatsumemio/HDDs# mount /dev/sdb1
mount: /dev/sdb1: can't find in /etc/fstab.
So that nails the coffin. Can anyone advice me on this?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
AndyMH
Level 21
Level 21
Posts: 13716
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can't set NTFS masks in /etc/fstab

Post by AndyMH »

Code: Select all

UUID=CA26D6FA26D6E68B /home/hatsumemio/HDDs/DataXT ntfs-3g auto,user,dmask=0070.fmask=0170 0 1
                                                                               ^
Should be a comma , not a full stop .
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Can't set NTFS masks in /etc/fstab

Post by rene »

You are moreover mounting with root ownership into your home directory which appears somewhat off. If definitely I'd want it mounted inside of home I'd use e.g.

Code: Select all

UUID=CA26D6FA26D6E68B /home/hatsumemio/HDDs/DataXT ntfs-3g noexec,uid=hatsumemio,gid=hatsumemio,dmask=022,fmask=133
If you do in fact want root ownership for the filesystem better could be to mount on e.g. /mnt/DataXT instead while leaving out that uid/gid part and just create a symlink e.g. ~/HDDs/DataXT to /mnt/DataXT.
yuuki47
Level 1
Level 1
Posts: 9
Joined: Mon Jul 05, 2021 11:34 am

Re: Can't set NTFS masks in /etc/fstab

Post by yuuki47 »

AndyMH wrote: Fri Oct 22, 2021 11:43 am

Code: Select all

UUID=CA26D6FA26D6E68B /home/hatsumemio/HDDs/DataXT ntfs-3g auto,user,dmask=0070.fmask=0170 0 1
                                                                               ^
Should be a comma , not a full stop .
Oh... I wasted so much time for such a silly thing. Well it actually works now, so... thank you for lending your keen eye!
rene wrote: Fri Oct 22, 2021 12:01 pm You are moreover mounting with root ownership into your home directory which appears somewhat off. If definitely I'd want it mounted inside of home I'd use e.g.

Code: Select all

UUID=CA26D6FA26D6E68B /home/hatsumemio/HDDs/DataXT ntfs-3g noexec,uid=hatsumemio,gid=hatsumemio,dmask=022,fmask=133
If you do in fact want root ownership for the filesystem better could be to mount on e.g. /mnt/DataXT instead while leaving out that uid/gid part and just create a symlink e.g. ~/HDDs/DataXT to /mnt/DataXT.
Will do, I just wanted to get the perms working first. Thanks for the help everyone.
User avatar
AndyMH
Level 21
Level 21
Posts: 13716
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can't set NTFS masks in /etc/fstab

Post by AndyMH »

Or you can use uid=1000 instead of uid=hatsumemio and the same again for gid. Mint assigns a uid of 1000 to the first user created which is usually you.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Can't set NTFS masks in /etc/fstab

Post by rene »

.... well, yes, but the point of using the username rather than the uid is sort of that it's better :)
User avatar
AndyMH
Level 21
Level 21
Posts: 13716
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can't set NTFS masks in /etc/fstab

Post by AndyMH »

Having used uid=1000 for a number of years, thinking about it, I reluctantly have to agree with you :D
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
mikeflan
Level 17
Level 17
Posts: 7106
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Can't set NTFS masks in /etc/fstab

Post by mikeflan »

whenever I would transfer text files/scripts out of the drive, Mint would ask me if I want to execute or display them
Surely it wouldn't ask this by merely doing the transfer. If so, I have never seen that. Maybe you mean you transfer the files and then double click on them?
Locked

Return to “Software & Applications”