whoozle / android-file-transfer-linux

Android File Transfer for Linux (and macOS!)
http://whoozle.github.io/android-file-transfer-linux/
GNU Lesser General Public License v2.1
1.45k stars 121 forks source link

Mounted volume is read-only #224

Open cpcallen opened 5 years ago

cpcallen commented 5 years ago

When I use aft-mtp-mount to mount my Pixel on macOS, the resulting mountpoint appears to be effectively read-only, despite there being no obvious reason why this should be the case. Passing -o rw does not help:

$ aft-mtp-mount -o rw,volname=Pixel ~/Pixel
$ cd Pixel/Internal\ shared\ storage/
$ touch foo
touch: foo: Permission denied
$ sudo touch foo
Password:
touch: foo: Operation not permitted
$ mount
[ … omitted …]
aft-mtp-mount@osxfuse0 on /Users/cpcallen/Pixel (osxfuse, nodev, nosuid, synchronous, mounted by cpcallen)

If I unmount the device I can access it using Android File Transfer for Linux.app which will happily let me create and delete files and directories, but via FUSE I have no luck.

Have I missed something? I don't see anything in the FAQ about this.

whoozle commented 5 years ago

could you check permissions for folders/files you see with ls -l or stat ?

cpcallen commented 5 years ago
$ ls -l
total 0
drwxr-xr-x  0 root  wheel  0  8 Sep  2018 Alarms/
drwxr-xr-x  0 root  wheel  0  6 Sep  2018 Android/
drwxr-xr-x  0 root  wheel  0 31 May  2019 DCIM/
drwxr-xr-x  0 root  wheel  0 30 May 18:57 Download/
drwxr-xr-x  0 root  wheel  0 10 Sep  2018 LazyList/
drwxr-xr-x  0 root  wheel  0  1 Jan  2009 Movies/
drwxr-xr-x  0 root  wheel  0  1 Jan  2009 Music/
drwxr-xr-x  0 root  wheel  0 31 May  2019 Notifications/
drwxr-xr-x  0 root  wheel  0 25 Feb 19:04 Pictures/
drwxr-xr-x  0 root  wheel  0  1 Jan  2009 Podcasts/
drwxr-xr-x  0 root  wheel  0  8 Sep  2018 Ringtones/
drwxr-xr-x  0 root  wheel  0 10 Sep  2018 SmartVoiceRecorder/
drwxr-xr-x  0 root  wheel  0  7 Sep  2018 panoramas/
whoozle commented 5 years ago

ah, I see, can you try sudo touch foo?

ops, sorry, that's what you've tried :)

whoozle commented 5 years ago

can you mount using -o debug option and see what request fuse sends after running sudo touch foo?

cpcallen commented 5 years ago

Sure:

$ touch foo
unique: 3, opcode: LOOKUP (1), nodeid: 2, insize: 44, pid: 5191
   unique: 3, error: -2 (No such file or directory), outsize: 16
unique: 4, opcode: LOOKUP (1), nodeid: 2, insize: 44, pid: 5191
   unique: 4, error: -2 (No such file or directory), outsize: 16
touch: foo: Permission denied
unique: 5, opcode: LOOKUP (1), nodeid: 2, insize: 56, pid: 5209
   unique: 5, error: -2 (No such file or directory), outsize: 16
unique: 6, opcode: LOOKUP (1), nodeid: 1, insize: 56, pid: 5209
   unique: 6, error: -2 (No such file or directory), outsize: 16
unique: 7, opcode: LOOKUP (1), nodeid: 2, insize: 56, pid: 5215
   unique: 7, error: -2 (No such file or directory), outsize: 16
unique: 8, opcode: LOOKUP (1), nodeid: 1, insize: 56, pid: 5215
   unique: 8, error: -2 (No such file or directory), outsize: 16
$ sudo touch foo
Password:
unique: 9, opcode: LOOKUP (1), nodeid: 2, insize: 44, pid: 5225
   unique: 9, error: -2 (No such file or directory), outsize: 16
unique: 10, opcode: LOOKUP (1), nodeid: 2, insize: 44, pid: 5225
   unique: 10, error: -2 (No such file or directory), outsize: 16
touch: foo: Operation not permitted
unique: 11, opcode: GETATTR (3), nodeid: 2, insize: 56, pid: 5226
   unique: 11, success, outsize: 136
unique: 13, opcode: LOOKUP (1), nodeid: 2, insize: 56, pid: 5243
   unique: 13, error: -2 (No such file or directory), outsize: 16
unique: 12, opcode: LOOKUP (1), nodeid: 1, insize: 56, pid: 5243
   unique: 12, error: -2 (No such file or directory), outsize: 16
unique: 14, opcode: LOOKUP (1), nodeid: 2, insize: 56, pid: 5249
   unique: 14, error: -2 (No such file or directory), outsize: 16
unique: 15, opcode: LOOKUP (1), nodeid: 1, insize: 56, pid: 5249
   unique: 15, error: -2 (No such file or directory), outsize: 16

I note that if I mount the same device using simple-mtpfs it mounts r/w.

whoozle commented 5 years ago

Could you please replace static constexpr unsigned FileMode = S_IFREG | 0644; static constexpr unsigned FileMode = S_IFREG | 0666;, and see if it changes anything?

(please check ls -l too)

FuseEntry.h, line 33