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.47k stars 120 forks source link

Nodes mounted as root, removal possible as regular user #310

Open laur89 opened 2 years ago

laur89 commented 2 years ago

Hi, I mounted the phone and got an error:

aft-mtp-mount ./phone/
Device::Find failed:Device is already used by another process

Having assumed the mount failed, I deleted the mountpoint:

rm -rf ./phone/

Turns out the mount had not failed, and data was lost.

How is it possible that rm succeeded? Mounting and traversing the file-tree shows all the directories-files are owned by root, and others have only read access.

Running android-file-transfer 4.2-1 on Debian testing. Android 11.

whoozle commented 2 years ago

Interesting, fuse does not (did not?) allow other users to do anything with mounted directory by default. What fuse version do you have? Did you pass -o allow_other to mount?

With fuse you don't have to do wrt permissions, they are returned as a part of stat structure. Modes for Files/Directories are :

        static constexpr unsigned       FileMode        = S_IFREG | 0644;
        static constexpr unsigned       DirectoryMode   = S_IFDIR | 0755;