sgan81 / apfs-fuse

FUSE driver for APFS (Apple File System)
GNU General Public License v2.0
1.77k stars 164 forks source link

permissions issue #83

Open yurikoles opened 5 years ago

yurikoles commented 5 years ago

At first I thought that problem with uid=yurikoles,gid=yurikoles, but same issue with numeric IDs.

$ ls /mnt -lah|grep macOS
ls: cannot access '/mnt/macOS': Permission denied
d?????????  ? ?         ?            ?            ? macOS
$ grep macOS /etc/fstab                               
UUID="f875d088-5a3c-47d0-b036-db8adf2a0f56" /mnt/macOS apfs uid=501,gid=22,pass=<removed> 0 0 
$ id yurikoles 
uid=501(yurikoles) gid=22(yurikoles) groups=22(yurikoles),999(adm),998(wheel),984(systemd-journal),1001(sdkusers),108(vboxusers)
$ sudo ls /mnt -lah|grep macOS
drwxr-xr-x  2 root      root         0 Jan  1  1970 macOS
yurikoles commented 5 years ago
$ mount|grep mac
/dev/sda2 on /mnt/macOS type fuse (ro,nosuid,nodev,relatime,user_id=0,group_id=0)
yurikoles commented 5 years ago
sudo apfs-fuse /dev/sda2 /mnt/macOS -opass=<removed>,user_id=501,group_id=22
Volume macOS is encrypted.
fuse: unknown option(s): `-o user_id=501,group_id=22'
sgan81 commented 5 years ago

Well, the options are uid=N, gid=N, and only numeric values are supported. Can you run it with an additional -d 15 option, and tell me if you see something relevant?

yurikoles commented 5 years ago

@sgan81 it's stuck with -d 15

sgan81 commented 5 years ago

Well, run apfs-fuse in one console, and execute the commands in another console. When running with debug flags, apfs-fuse will not return until the volume is unmounted. Because it will display all the info in the console.

yurikoles commented 5 years ago

Nothing interesting, because I can't even access volume as normal user (uid, gid). So nothing is print in debug. apfs-fuse set correct rights inside volume but mount dir is owned by root:root, even if I explicitly chown dir before mounting.

yurikoles commented 5 years ago
$ ls -lah /mnt|grep mac  
ls: cannot access '/mnt/macOS': Permission denied
d?????????  ? ?         ?            ?            ? macOS
$ sudo ls -lah /mnt|grep mac
drwxr-xr-x  2 root      root         0 Jan  1  1970 macOS
carlor commented 5 years ago

I had a similar issue, it turned out to be permission to access the device. Does this work for you?

$ sudo chmod +r /dev/sda2

(Edit: I also need to run apfs-fuse as myself, not root)

yurikoles commented 5 years ago

Other FUSE and non-FUSE FSes doesn't have this issue, for example NTFS-3g.

sgan81 commented 5 years ago

Did you mount as root and try to access it as user? If yes, did you mount with -o allow_other?

yurikoles commented 5 years ago

@sgan81, yes, allow_other did the trick, but other filesystems automatically set permissions for mount dir to uid, gid.

$ ls -lah /mnt|grep macOS
drwxr-xr-x  2 root      root         0 Jan  1  1970 macOS
$ ls /mnt/macOS -lah
total 0
drw-r--r-- 1 yurikoles yurikoles 65 May 23 20:30 private-dir
drwxr-xr-x 1 yurikoles yurikoles 31 May 23 20:25 root
$ ls -lah /mnt|grep win
drwxrwxrwx  1 yurikoles yurikoles 4.0K May 24 08:52 win
$ grep win /etc/fstab                   
LABEL=windows           /mnt/win        ntfs-3g uid=yurikoles,gid=yurikoles     0       0
stevenhurwitt commented 4 years ago

I had a similar issue, it turned out to be permission to access the device. Does this work for you?

$ sudo chmod +r /dev/sda2

(Edit: I also need to run apfs-fuse as myself, not root)

maybe this would've been fine if i had used the allow_other option, but for me i had to chown and chmod +rwx of my mountpoint. then run apfs-fuse without sudo.