On Thursday, 16 May 2024 10:42:16 BST Nuno Silva wrote:
> On 2024-05-16, Walter Dnes wrote:
> > On Wed, May 15, 2024 at 03:06:50PM -0700, Mark Knecht wrote
> > 
> >> Have you checked that the directory where you are attempting to
> >> do this is one that your account owns? I generally have to su - to
> >> root, create a directory at the top level, change it so that I own it and
> >> have rwx permissions, and then exit root. After that I can do what I
> >> want.
> >> 
> >   I have a short script ~/bin/tabon
> > 
> > [x8940][waltdnes][~] cat bin/tabon
> > #!/bin/bash
> > sudo /usr/bin/jmtpfs /home/waltdnes/tablet -o allow_other,auto_unmount,rw
> > #
> > # Only needed once
> > #sudo /bin/chown -R waltdnes:users /home/waltdnes/tablet
> > 
> >   The last (commented out) line *USED TO WORK*.  Now it spits out a
> > 
> > whole slew of...
> > 
> > /bin/chown: changing ownership of
> > '/home/waltdnes/tablet/sdcard1/blah_blah_blah': Function not implemented
> > 
> > ...one for each direcory and file.  I believe the phone formats the card
> > as either FAT32 or XFAT.
> 
> Did anything change? Any tablet software upgrade? Did the MTP tool on
> the computer side change? Or perhaps the kernel, if it can influence
> this FUSE interaction somehow?
> 
> At this point I'd consider testing with known good versions if possible
> (those that can run chown without that error). Is mkdir something that
> used to work too?
> 
> The "Function not implemented" looks off for something that used to work
> before. (Or was it failing silently before? If this is FAT* or exFAT,
> wouldn't ownership be a thing for the FUSE tool to set itself? Or does
> exFAT have the concept of ownership?)

FAT/exFAT do not support filesystem level user permissions and consequently 
you would get a "Function not implemented" error with chown.

When a USB device with a FAT/exFAT fs, is mounted with udisksctl they show up 
as:

$ lsblk -o PATH,TYPE,FSTYPE,OWNER,GROUP,MODE,MOUNTPOINT /dev/sdb1
PATH      TYPE FSTYPE OWNER GROUP MODE       MOUNTPOINT
/dev/sdb1 part vfat   root  disk  brw-rw---- /run/media/michael/CRUCIAL-8G

and the fs is mounted with the sticky bit so it writeable by the user:

$ ls -la /run/media/michael/CRUCIAL-8G/
total 2500976
drwxr-xr-x  2 michael michael      16384 Jan  1  1970  .
drwxr-x---+ 3 root    root            60 May 16 15:52  ..


exFAT looks the same if you have enabled the exFAT kernel driver, as opposed 
to using FUSE.

I don't have a device using MTP here to check how it is mounted over FUSE, but 
FUSE is meant to mount a device with the permissions of the user who mounts it 
AND the user can only mount on a mountpoint for which they have write 
permission.

However, there is a kernel bug if the default_permissions mount option has not 
been used, whereby results of the first permission check performed by the file 
system for a directory entry are cached and reused - even if the permissions 
have since changed - see here:

https://github.com/libfuse/libfuse

I do remember having some trouble creating directories on an SD card in a 
GARMIN GPS device.  I had to remove it and mount it on Linux to be able to 
work on it, but can't recall the details. 

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to