When I'm mounting a drive it changes both the owner of the directory and the write and read premissions. For some reason chmod command doesn't work, and I can't change it with the UI because of the ownership. Is there a way to mount the drive but keep the ownership? I've used sudo mount to mount it and tried sudo chown and sudo chmod to change ownership and premissions respectively, none of them worked. the partition type is FAT32
1 Answers
When I'm mounting a drive it changes both the owner of the directory and the write and read premissions.
... to the user you mount it with otherwise it mounts to root.
For some reason chmod command doesn't work, and I can't change it with the UI because of the ownership.
chmod only works on posix compliant systems. That is for instance ext, and not ntfs or fat.
Is there a way to mount the drive but keep the ownership? I've used sudo mount to mount it and tried sudo chown and sudo chmod to change ownership and premissions respectively, none of them worked. the partition type is FAT32
FAT32: during the mount you tell it to use a specific user. Example:
sudo mount -t vfat /dev/{device} /media/{mountpoint} -o rw,uid=1000,gid=1000,umask=113,dmask=002
where 1000 is your admin and files are set to rw-rw-r--
and folders are set to rwxrwxr-x
(it uses umask so a reversed chmod).
id -u {username}
to find the userid of a user.
You can use the actual username in /etc/fstab if you want.

- 299,756
-
it worked, now I'm the owner, but chmod still does not work... – חננאל רועי ארבל Nov 14 '21 at 17:06
-
and it never ever will. chmod is for posix compliant filesystems. fat is not 1 of those. – Rinzwind Nov 14 '21 at 17:14
-
-
-
I didn't understand... do you want me to change the drive's gid? – חננאל רועי ארבל Nov 14 '21 at 17:36
mount
say about the drive? Are you running Ubuntiu? Readman mount
. You can specify ownership as youmount
. – waltinator Nov 14 '21 at 15:24