Score:0

Is it possible to mount a drive without changing the directory owner to root?

mx flag

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

in flag
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
waltinator avatar
it flag
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`.
Elder Geek avatar
cn flag
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)
Score:1
cn flag

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.

חננאל רועי ארבל avatar
mx flag
it worked, now I'm the owner, but chmod still does not work...
cn flag
and it never ever will. chmod is for posix compliant filesystems. fat is not 1 of those.
חננאל רועי ארבל avatar
mx flag
so I can't allow all users to write this drive?
cn flag
yes you can. see the gid (group id) option
חננאל רועי ארבל avatar
mx flag
I didn't understand... do you want me to change the drive's gid?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.