Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show dirs known to exist instead of Permission denied. #252

Closed
ole-tange opened this issue Jan 26, 2022 · 3 comments
Closed

Show dirs known to exist instead of Permission denied. #252

ole-tange opened this issue Jan 26, 2022 · 3 comments
Milestone

Comments

@ole-tange
Copy link

ole-tange commented Jan 26, 2022

I hate that I cannot access all files that a normal filemanager has access to in a single namespace using sshfs.

I understand that I can use SAF to select which folder to access, but I would much rather access everything in one go.

So I propose a slightly modified "Plain old filesystem": Identify all the paths that can be accessed by the user and present those in a single namespace. For dirs that you do not have -r right to, assume it is empty apart from the dirs that we know must exist.

For example: When starting the server it tests "well-known" paths, such as /storage/emulated/0. Let us assume it exists and is readable/writable by the user. Let us assume / and /storage/emulated/ only have -x, so you cannot list the files in those dirs.

You can, however, determine that /storage and /storage/emulated/0 do exist, so instead of failing to list anyting in / and /storage/emulated list /storage and /storage/emulated/0 repectively.

In other words:

$ sshfs -p 1234 [email protected]:/ phone
$ cd phone
$ ls
(Here you would normally get: ls: reading directory '.': Permission denied)
storage
$ cd storage
$ ls
0F74-0C3F  emulated  self
$ cd emulated
(Here you would normally get: ls: reading directory '.': Permission denied)
0
$ cd 0
$ ls Android
data  media  obb

This way you would be able to do things like:

du phone

and get the usage of both /storage/emulated/0 an /storage/0F74-0C3F.

Without rooting the phone I understand this cannot be perfect: You cannot know if someone has created /storage2 that you have full access to. But you can at least try all the "well-known" paths and see which of these exist. I believe Android also has a way to list the paths of some user dirs, and it will be natural to test if these exist, too.

@wolpi
Copy link
Owner

wolpi commented Jan 29, 2022

That is a little similar to VirtualFolders just added recently
be15f50

@lmagyar
Copy link
Contributor

lmagyar commented Sep 28, 2024

#352 fixed this in 7.2. Also these "injected" folders and their parents got r and x mode flags enabled to make them "friendly" to file-managers and sshfs. Note: it is possible to add other "known to exists" folders.

So I think this issue can be closed.

@wolpi wolpi added this to the 7.2 milestone Sep 29, 2024
@wolpi
Copy link
Owner

wolpi commented Sep 29, 2024

And it is released already

@wolpi wolpi closed this as completed Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants