0

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

  • 4
    Given the initial information in your question, the answer is “it depends”. Can you [edit] your question to include: (0) the type of file system you are mounting (Ext4 / NTFS / etc) (1) the command you are using to mount the partition(s). With this, it becomes possible to offer an answer – matigo Nov 10 '21 at 22:24
  • How are you mounting the drive? What does `mount` say about the drive? Are you running Ubuntiu? Read `man mount`. You can specify ownership as you `mount`. – waltinator Nov 14 '21 at 15:24
  • Does this answer your question? [How do I change file permissions on a FAT32 drive?](https://askubuntu.com/questions/118199/how-do-i-change-file-permissions-on-a-fat32-drive) – Elder Geek Nov 15 '21 at 17:27

1 Answers1

1

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.

Rinzwind
  • 293,910
  • 41
  • 570
  • 710