Write denied on exfat usb hdd mounted locallly

I don’t understand whats going on here, i’m using several exfat partition’s on my USB HDD’s also and never had the slightest access problem.

It was always running flawless like a native ext4 partition. The only difference is, that i use Veracrypt to mount it.

I never used all this complicated mount commands or was in need to load additional exfat packages and have 99 more problems.

Since when there is write access denied? Maybe this device has some serious issues…

I never had any issues either - but there is a clear difference betwen

  • kernel exFAT programs
  • userspace exFAT programs

Plasma’s kio and the generic gvfs handles access to devices flawless on systems with kernel exFAT programs.

The issue appears when you use the mount command to mount in a specified folder.

Because you can only use mount as superuser the mount is inheriting root permissions - which makes the device read-write for root only.

Manjaro default to use kernel exFAT programs so a mounting a exFAT device in a specific folder makes root the owner and denies write to all other users even when mounting in a user’s home.

Replacing the kernel exFAT programs with the userspace exFAT programs makes the mount writeable for world - just as one would expect.

I have seen several comments lately where members have trouble understanding why they cannot access their NFTS and exFAT devices the same way they are used to.

I have been slightly confused myself over these topics - but from the investigation I conducted for this topic - I am fairly certain it is related to improvements in security for filesystems not native to Linux.

E.g. to avoid malicious change to the systems efi partition

  • FAT32
  • mounted at /boot/efi

This is achieved by applying mount options umask=0077 in /etc/fstab making it inaccessible to everyone but root.

3 Likes

Did the mount according to ur command above.

sudo chown -R $USER:$USER ~/mount-6TB

ls -ld mount-6TB                                      
drwxr-xr-x 974 root root 1048576 Jul  4 22:56 mount-6TB
whoami                                                     
manjaro

How do you get the fmask and dmask value ? i can’t seems to find way to calculate the value that i want.
i want
file permission: owner (rwx), group (r-x), other (—)
folder permission: owner (rwx), group (r-x), other (—)
How to calc ?
Thanks.

Btw, your cmd with fmask and dmask did the trick.
I now realized the issue with write denied is due to exfat does not have permission metadata… hence when i mount it as normal fs, it will causes the exfat fs being mounted under root owner… hence it made it to be owner of the exfat to be root… hence when i am in manjaro user acc, i can’t write to the fs.

I can access it with

Denied because exfat has not permission metadata. hence when sudo mount, it mount as root…
the way to overcome mount as root is :

sudo mount -t exfat -o sync,rw,uid=$UID,gid=$GID,fmask=0002,dmask=0002,iocharset=utf8 /dev/disk/by-partuuid/e5608bd6-3920-4b72-972d-6c29f1d0305e mount-6TB 

the uid and gid value is the key here.

1 Like

chown is futile against FAT fs, due to it does not consist of permission metadata.

there are rwx permissions for owner, group and others

r (read) counts 4
w (write) counts 2
x (execute) counts 1

file permission: owner (rwx), group (r-x), other (—)

corresponds to 750

1 Like

hmm… u made a mistake somewhere… fmask is opposite of chmod

i tried ur fmask=0750… the outcome is
0750 u(---),g(-w-),o(rwx)

i tried on errors until i got this:
0117 u(rw-),g(rw-),o(---)
001 001 111
1 1 7
can u go through that again and teach me how to calculate… i used to learn binary … but i have since return everything to my teacher…
sort of understand… but don’tknow how to calculate… especially when this is “mask” (sort of opposite)

This mount along took me days to get it understood… and it is base on fat only. my brain is rusty.
still got manjaro to fix… hopefully won’t take 1 month to learn how to fix… sigh.!

$udisksctl mount -b /dev/sdb1
This will be a short and sweet cmd to mount to it own /run/media folder with no permission issue. just can’t define where to mount…

you asked for how file permissions are calculated

touch testfile

chmod 750 testfile 
ls -al testfile 
-rwxr-x--- 1 jo jo 0 Jul  7 23:54 testfile
chmod 057 testfile 
ls -al testfile 
----r-xrwx 1 jo jo 0 Jul  7 23:54 testfile

no - sorry

sorry for the misunderstand. i was meant to say for fmask and dmask.

For each permission, ower/group/other. It is just a 3-bit binary value. So from most to least significant bits (or flags in this context):

  1. Read access
  2. Write access
  3. Executable (or directory listing access for directories)

So in binary, each digit is worth 4, 2, and 1 respectfully. You just add them up to get every combination of rwx or not. This is a number between 0 and 7.

When you put three in a row, you get the user/group/other permissions, as a 3 digit number (that are 0-7).

You can not use this octal format at all, if you want. It is just a quicker way if you’re used to it.

I think you are confusing something here - exfat and ext4 is two different filesystems

  • exfat is Windows filesystem created
  • ext4 is the defacto Linux filesystem

Simple

0777 == u+rwx,g+rwx,o+rwx
0000

so for any directory

0755 == u+rwx,g+rx,o+rx
0022

and for files

0644 == u+rw,g+r,o+r
0133

The best option for you is to use the userspace programs.

sudo pacman -Syu exfat-utils

This will give you want you need - a permissionless exfat mount

Permissions set only applies for the mountpoint - see the permissions like a sheeps pen

  • read permissions lets you look at the sheeps
  • write permissions lets you go through the gate
  • once you are inside you can slaughter all sheeps
4 Likes

Got it. Thanks.

1 Like

Is it valid if i enter mask with 3 digits only?
fmask=007 for files (rwx, r–, —)
mask=022 for folders (rwx, r-x, r-x)

is it valid if enter chmod permission in 4 digits ?
chmod 0740 for files (rwx, r–, —)
chmod 0755 for folders (rwx, r-x, r-x)

This will clear my doubts in my mind regarding fmask and chmod.
If mask can be enter 3 digits (instead of what i see all 4 digits), why do i bother to confuse myself with 4 digits when convert from chmod permission ?

thanks.

Please see → umask - ArchWiki

Use the userspace tools - then you don’t have to bother at all …

1 Like

fmask and dmask are the bisected versions of the umask for files and directories respectively in the mount options for non-POSIX filesystems.

As for how to calculate the values, see the following two sections from my tutorial on POSIX permissions:point_down:

1 Like

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