LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Can't change ownership of file, even using sudo (https://www.linuxquestions.org/questions/linux-desktop-74/cant-change-ownership-of-file-even-using-sudo-4175716866/)

mstrimel 09-17-2022 05:06 PM

Can't change ownership of file, even using sudo
 
Hello,
I have an external USB drive on which I created a exFAT partition. I mounted it at /media/filestogo and after chmod'ing that directory to 777. When I try to copy files to that directory in Nautilus, I get the error that I do not have permission. So, I tried to chown the directory /media/filestogo to user mary. However I get an error:
Code:

mary@mythbox:~]$ ls -la /media/filestogo
total 132
drwxr-xr-x. 2 root root 131072 Sep 17 17:52 .
drwxr-xr-x. 9 root mary  4096 Sep 17 17:50 ..
[Sat Sep 17 18:05:12]
mary@mythbox:~]$ sudo chown mary /media/filestogo
chown: changing ownership of '/media/filestogo': Operation not permitted
[Sat Sep 17 18:05:22]

What am I doing wrong? I checked the mount options of the USB drive and it is mounted rw.
Thanks,
Mary

Emerson 09-17-2022 05:17 PM

I'd suspect exFAT does not support UNIX style permissions and ownership. Perhaps you can mount it as user mary, then ownership should change, methinks.

rkelsen 09-17-2022 05:19 PM

Can't change ownership of file, even using sudo
 
What options did you use in your mount command?

mstrimel 09-17-2022 06:42 PM

Quote:

Originally Posted by Emerson (Post 6380850)
I'd suspect exFAT does not support UNIX style permissions and ownership. Perhaps you can mount it as user mary, then ownership should change, methinks.

Thank you, that was the solution. I changed the /etc/fstab file to specify "user" as an option.

frankbell 09-17-2022 09:05 PM

Just as an aside, Emerson is correct. Non-*nix filesystems do not recognize/support Linux permissions.

Emerson 09-17-2022 09:19 PM

I haven't used non-nix filesystems for so long (15+ years) I really wasn't sure what is the best way to solve this and I had nothing to try it on.

frankbell 09-17-2022 09:42 PM

It's something I learned along the way, but so long ago I can't cite a source.

ferrari 09-17-2022 11:44 PM

FAT/exFAT and NTFS (Microsoft) file systems don't support Linux user and group permissions. These are essentially faked by the kernel when mounted.

For more info refer
Code:

man mount.exfat
https://www.systutorials.com/docs/li...8-mount.exfat/
Code:

man mount.ntfs
https://www.systutorials.com/docs/li.../8-mount.ntfs/

shevegen 09-25-2022 08:25 AM

Interesting - I never knew about mount.exfat. This may
explain similar errors I got in the past.

I found the thread here via a google search.

Would be great if the whole Linux stack would be more
"clever"; would help avoid me having to google, with
a better "live" documentation system as-is.

Emerson 09-25-2022 09:48 AM

'mount' command calls 'mount.<filesystem>', you will be using mount.exfat when you mount exfat filesystem.


All times are GMT -5. The time now is 10:42 AM.