2

Note: If you don't mind reading all these, jump to "The Questions" section.

The Actual Problem

I have write permissions problems with both my external (i.e. external SD card) and internal storages on my rooted Android box (i.e. it's ViperOS ROM, if it helps) (mounted at /storage), especially the external one. The behavior on terminal and GUI is, strangely, different.

(External storage problem only) Using either Termux or internal Terminal app, when I try to do any write operations from a non-root user (e.g. create a directory, remove a file), I get "Permission denied" error (From a non-root ADB user, however, I never get errors). Storage permission is not a problem here, as it's granted.

Using GUI, the only problematic operation is removing directories (whether empty or not), and as a result, moving directories also (i.e. actually, they get copied, but the source is not removed). Even renaming directories is possible. All file operations are possible, too.

However, there's a different between where the problematic operation is done: from the laptop with phone connected to it, the operation fails; but from an app (e.g. default Files app) inside the phone (without any root permissions), it gets done, but it shows it failed (!).

What I Tried

These are all permissions problems (oh, really?!). To make things easier, I'll focus on external storage (i.e. external SD card) only. It is located (i.e. mounted) on /storage/9B6C-CF9F/.

Note: Because the results of ADB and internal terminal are somehow different, and it seems the results of internals are more reliable, so I'll post them instead. Also, keep in mind, # means the command is being run as root. Unrelated stuff is replaced with ....

Initially, I ran stat:

# stat /storage/9B6C-CF9F/
  File: `/storage/9B6C-CF9F/'
  Size: 8192     Blocks: 16  IO Blocks: 512 directory
Device: 19h/25d  Inode: 0    Links: 4
Access: (755/drwxr-xr-x)    Uid: (    0/    root)   Gid: ( 9997/everybody)
...

And immediately I realized that only root have write permissions on /storage/9B6C-CF9F/ (i.e. my external storage). Tried chmod. No errors. Worked? No. stat is the same as before, meaning no permissions was changed. Why?! I tried to figure it out:

# mount | grep /storage/9B6C-CF9F
/dev/fuse on /storage/9B6C-CF9F type fuse (rw,nosuid,nodev,noexec,noatime,user_id=1023,group_id=1023,default_permissions,allow_other)

The problem is here: The mount point is of FUSE type, and I know little about it. So:

The Questions

  1. How to (mount or) remount an FUSE partition, possibly with one or more specified options, especially permission-wise options (like rootmode), using mount command (on Android)?

  2. How to find the location of the actual device behind that FUSE filesystem, in /dev/ directory (Is there any underlying device at all)?

Other questions:

  1. (If you've read the past two sections,) Is there an alternative way to fix the mentioned permissions problem?

  2. If root has only write permissions to my external storage, then how applications write data to it?

Notes

  • While I was reading the man-page of fuse on Fedora, I found that there are some FUSE mount options regarding permissions, like rootmode and umask. However, the problem is, I don't know how to mount it with these options, and how /dev/fuse knows where to find my external storage (or even internal).

  • There is a discussion on where Android's fstab is located. I have found it on my device, however, there is no line pointing to fuse type. The only related lines I could find are:

    # cat /fstab.sc8830
    ...
    # VOLD : fstab_dt_otg.sc8830
    /devices/sdio_sd/mmc_host/mmc1*           auto         auto defaults                            voldmanaged=sdcard1:auto,encryptable=userdata
    /devices/20200000.usb/usb*            auto         auto defaults                            voldmanaged=usb:auto
    ...
    

    What does these mean? Are they related or not? I don't really know. Also, no file named fstab_dt_otg.sc8830 exists there (i.e. on /).

2

1 Answer 1

0

how about trying to chang the mask setting?

mount -t vfat -o umask=0000 /dev/block/mmcblk1p1 /storage/9B6C-CF9F

remember to change device block reference to your external sdcard

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 7, 2022 at 15:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .