Closed rptb1 closed 3 years ago
This may not be an app permissions issue, but something to do with filesystem permissions or the way bind mounts and sdcardfs mounts are set up. Here's some evidence:
.../FB03-5D01/Download $ sudo sh -c "echo foo > bar"
.../FB03-5D01/Download $ cat bar
foo
.../FB03-5D01/Download $ df .
Filesystem 1K-blocks Used Available Use% Mounted on
/mnt/media_rw/FB03-5D01 104831968 1041216 103790752 1% /storage/FB03-5D01
.../FB03-5D01/Download $ mount | grep FB03
/dev/block/vold/public:179,65 on /mnt/media_rw/FB03-5D01 type vfat (rw,dirsync,nosuid,nodev,noexec,noatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/mnt/media_rw/FB03-5D01 on /mnt/runtime/default/FB03-5D01 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6)
/mnt/media_rw/FB03-5D01 on /mnt/runtime/read/FB03-5D01 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
/mnt/media_rw/FB03-5D01 on /mnt/runtime/write/FB03-5D01 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
/mnt/media_rw/FB03-5D01 on /mnt/runtime/full/FB03-5D01 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=7)
/mnt/media_rw/FB03-5D01 on /storage/FB03-5D01 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
.../FB03-5D01/Download $ ls -ld .
drwxr-xr-x 2 root everybody 32768 Jan 14 11:41 .
.../FB03-5D01/Download $ su
:/storage/FB03-5D01/Download # ls -ld /mnt/runtime/*/FB03-5D01/Download
drwxrwx--x 2 root sdcard_rw 32768 2021-01-14 11:41 /mnt/runtime/default/FB03-5D01/Download
drwxrwx--- 2 root everybody 32768 2021-01-14 11:41 /mnt/runtime/full/FB03-5D01/Download
drwxr-xr-x 2 root everybody 32768 2021-01-14 11:41 /mnt/runtime/read/FB03-5D01/Download
drwxr-xr-x 2 root everybody 32768 2021-01-14 11:41 /mnt/runtime/write/FB03-5D01/Download
Duplicate of https://github.com/termux/termux-app/issues/20, https://github.com/termux/termux-app/issues/1683 (and some other issues).
It is currently only possible to write to termux's folder on the external storage, /storage/FB03-5D01/Android/data/com.termux/files/
(i.e. ~/storage/external-1).
Might be possible to make it work for android <= 10, but requires some work, discussed in https://github.com/termux/termux-app/issues/1617, https://github.com/termux/termux-packages/issues/5486
Problem description
I have a Fairphone 3 with an SD card slot, and I have installed an SD card with a single FAT partition formatted by the phone.
termux-setup-storage
asks for permission to access /storage/emulated/0, and that all works, but it does not ask for permission to access /storage/ID and Termux can't write to any files there.By contrast, Resilio Sync (also on SDK 28) explicitly asks to be granted permission to the SD card and after doing so, is able to write there.
Note that my Termux has been granted the "Storage" permission in the apps settings. This is a separate permission.
I have read Internal and external storage but this is not about /storage/emulated/0, which is on my phone's internal flash memory.
Steps to reproduce
termux-setup-storage
cd /storage/ID/Download
(substitute the id of your SD card's FAT FS)echo foo > bar
gets a permission denied messageExpected behavior I want to be able to work on files on the SD card using Termux.
Perhaps
termux-setup-storage
needs to ask for more permission.Additional information