0

I was trying to use an USB-stick in Linux and it didn't go as expected:

I had already created a mountpoint (/mnt), found the device of the newly inserted USB-stick (/dev/sdb1) and mounted it:

# ls -l /dev/sdb1 brw-rw---- 1 root disk 8, 17 Aug 7 16:05 /dev/sdb1 # ls -ld /mnt drwxrwxrwx 2 root root 4096 Jul 31 2020 /mnt # mount /dev/sdb1 /mnt # mount | grep sdb /dev/sdb1 on /mnt type exfat(rw,relatime,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro) # ls -ld mnt drwxr-xr-x 2 root root 131072 Aug 7 16:23 mnt 

The problem was now that the stick was writable only for root. So I changed the filemode of the directory - which didn't work at all, although no error was issued:

# chmod -R 777 /mnt # ls -ld mnt drwxr-xr-x 2 root root 131072 Aug 7 16:23 mnt 

(I also tried "0777" instead of "777" - no difference.) Not being all too familiar with Linux I suspected the problem being that I tried to do something in the root directory. So I created a subdirectory "/mnt/usb1" and repeated above procedure - with the same result. The chmod command came back without an error but the filemode wasn't changed. As a last resort I tried changing the ownership - which lead to an error ("user" is an existing user/group on this system):

# chown user:user /mnt chown: changing ownership of '/mnt': Operation not permitted 

My system uses kernel 5.15.0-97-generic, if you need more/other information please ask and I will edit it in.

Can someone shed light on what I did wrong? Both commands (chown as well as chmod) are standard UNIX commands and the system I usually work with (AIX) would have done exactly what I intended to do.

As A bonus: if someone could also answer why the chown was "not permitted" I'd be glad.

1 Answer 1

2

exfat filesystems don't support the Linux ownership/permission scheme, so ownership and permissions have to be specified at mount time.

Read man mount, paying particular attention to the EXFAT section.

Then do something like (UNTESTED - I don't have your system):

sudo mount -o remount,rw,uid=$(id -u),gid=$(id -g),relatime,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro) 

Changing fmask and dmask according to taste.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.