-
Notifications
You must be signed in to change notification settings - Fork 6
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
[Bug]: Cannot read or execute files under /sdcard without root privilege #18
Comments
@erhenjt Thanks for reporting and providing clear information! On newer Android versions this requires the Unfortunately, when submitted to Google Play with that permission, it was not accepted, with the motivation that it did not fulfil the linked requirement above:
I'm trying to convince the Google play reviewers to grant this, but so far it looks unlikely that they will budge. If so, the second best thing is probably to provide built-in utility scripts to fetch and insert files to shared storage using the Storage Access Framework. |
@fornwall Thank you for clarifying.
There are many file management and archive management apps (such as Total Commander, X-plore File Manager, ZArchiver and RAR) that actually claimed By the way, do you mind explaining why Termux can list the directories under /sdcard but not the files, and when directly ls the file name, it is able to list that specific file? Thanks. |
Actually just found that there are many IED apps like Pydroid 3, Jvdroid and Cxxdroid also have the Maybe it's worth asking these developers how did they manage to pass the Google Play review? |
Thanks for looking that up! Those indeed seems like apps quite similar to Termux, so can be used as "if they can get it, so should we" argument - even though the Google Play review process is quite non-deterministic/varies over time and between apps, unfortunately. Have now created a |
Just an update that the build with |
It passed Google Play review, and the current version Note that files stored on Leaving this issue open to monitor and follow up issues or questions for a while. |
Congratulations on passing Google Play review! An idea for executing files in /sdcard: |
@fornwall Just tested the commands cp /sdcard/1 /data/data/com.termux/files/usr/tmp/ && chmod a+x /data/data/com.termux/files/usr/tmp/1 && /data/data/com.termux/files/usr/tmp/1 with a 100MB binary file 1. So a possible workaround will be:
Is this possible to do? And are there any downsides to this solution? |
@erhenjt Something like copying away the file for execution as you are doing should work, and you could check set up some shell script tool to automate that for you, perhaps
Should perhaps be good enough? Perhaps it's hard to make some generic mechanism as people would like to tweak the exact behaviour, but some custom shell script might be good enough. Out of interest if you want to share, which executables do you have on |
Personally I don't have a need to run executable in Termux (for now), but I think the ability to run executable files is one of the most basic features for a Linux terminal environment and it will enable users to run varies softwares that are only in binary format and not being packed into deb/rpm on their devices.(such as many GitHub projects, and especially since more projects are adding support for aarch64) And if user replaced the binaries, it can be runned without having to manually copy-paste/setup permission/change directory. |
And if you were asking about the testing file, it was a static curl, and I appended a 100M file to it just to test whether it would be feasible and fast enough to copy the file to Termux data directory with larger files. |
Problem description
After executing
termux-setup-storage
and granting storage permissions, Termux is unable to read, execute or list files under /sdcard or any subfolders of /sdcard (using ls). (However it was able to list the file when using ls /sdcard/filename.)Granting root privilege with su or sudo circumvents this, but it will require users to root their phones which is not possible with some modules.
Steps to reproduce the behavior.
1
under internal storage or any subfolder of it such asDownload
foldertermux-setup-storage
and grant storage permissions/sdcard/1
,/sdcard/Download/1
,/storage/emulated/0/1
,/storage/emulated/0/Download/1
,/storage/self/primary/1
,/storage/self/primary/Download/1
returns "Permission denied"
nano
before above commands prompt "Permission denied" in nano editorls
before above commands was able to list the specific files/1
in above commands lists no files but only folders under that that directoryWhat is the expected behavior?
Termux should be able to read, write and execute files in internal storage and its subfolders
System information
The text was updated successfully, but these errors were encountered: