I previously posted on the Linux stack exchange about my problem:
https://unix.stackexchange.com/questions/731882/termux-bash-permission-denied
Suffice to say I've realized that executable files can be run in Termux's home folder (at least that's what I assume ~
is), as well as in ~/storage
, but when I move my compiled file hello
and hello.cpp
into ~/storage/shared
the files no longer have permission to be executed:
~/storage $ clang++ hello.cpp -o hello
~/storage $ ls -l
total 60
lrwxrwxrwx 1 u0_a347 u0_a347 24 Jan 15 12:21 dcim -> /storage/emulated/0/DCIM
lrwxrwxrwx 1 u0_a347 u0_a347 28 Jan 15 12:21 downloads -> /storage/emulated/0/Download
-rwx------ 1 u0_a347 u0_a347 53544 Jan 16 14:44 hello
-rw------- 1 u0_a347 u0_a347 88 Jan 16 14:44 hello.cpp
lrwxrwxrwx 1 u0_a347 u0_a347 26 Jan 15 12:21 movies -> /storage/emulated/0/Movies
lrwxrwxrwx 1 u0_a347 u0_a347 25 Jan 15 12:21 music -> /storage/emulated/0/Music
lrwxrwxrwx 1 u0_a347 u0_a347 28 Jan 15 12:21 pictures -> /storage/emulated/0/Pictures
lrwxrwxrwx 1 u0_a347 u0_a347 19 Jan 15 12:21 shared -> /storage/emulated/0
~/storage $ ./hello
hello world
~/storage $ mv hello hello.cpp shared
~/storage $ ls -l
total 0
lrwxrwxrwx 1 u0_a347 u0_a347 24 Jan 15 12:21 dcim -> /storage/emulated/0/DCIM
lrwxrwxrwx 1 u0_a347 u0_a347 28 Jan 15 12:21 downloads -> /storage/emulated/0/Download
lrwxrwxrwx 1 u0_a347 u0_a347 26 Jan 15 12:21 movies -> /storage/emulated/0/Movies
lrwxrwxrwx 1 u0_a347 u0_a347 25 Jan 15 12:21 music -> /storage/emulated/0/Music
lrwxrwxrwx 1 u0_a347 u0_a347 28 Jan 15 12:21 pictures -> /storage/emulated/0/Pictures
lrwxrwxrwx 1 u0_a347 u0_a347 19 Jan 15 12:21 shared -> /storage/emulated/0
~/storage $ cd shared
~/storage/shared $ ls -l
total 150
drwxrws--- 2 u0_a234 media_rw 3452 Aug 9 21:45 Alarms
drwxrws--x 6 media_rw media_rw 3452 Oct 4 19:30 Android
drwxrws--- 2 u0_a234 media_rw 3452 Aug 9 21:45 Audiobooks
drwxrws--- 3 u0_a234 media_rw 3452 Oct 4 17:58 DCIM
drwxrws--- 6 u0_a234 media_rw 3452 Jan 4 20:33 Documents
drwxrws--- 2 u0_a234 media_rw 3452 Jan 16 13:13 Download
drwxrws--- 3 u0_a234 media_rw 3452 Aug 9 21:45 Movies
drwxrwsr-x 4 media_rw media_rw 3452 Aug 9 21:45 Music
drwxrws--- 2 u0_a234 media_rw 3452 Aug 9 21:45 Notifications
drwxrws--- 3 u0_a234 media_rw 3452 Aug 9 21:45 Pictures
drwxrws--- 2 u0_a234 media_rw 3452 Aug 9 21:45 Podcasts
drwxrws--- 2 u0_a234 media_rw 3452 Aug 9 21:45 Recordings
drwxrws--- 2 u0_a234 media_rw 3452 Aug 9 21:45 Ringtones
-rw-rw---- 1 u0_a234 media_rw 53544 Jan 16 14:44 hello
-rw-rw---- 1 u0_a234 media_rw 88 Jan 16 14:44 hello.cpp
~/storage/shared $
I've heard that external sd cards are mounted with a noexec
flag, but this is internal storage on my Galaxy Tab S7 FE, so I haven't found anything related to internal storage.
What I'm hoping to be able to do is write C/C++ (and other compiled languages) in another app (say, Acode) in any folder, then using Termux, compile them, and run them. So far I can run HTML/CSS/JS files natively in Acode and I can run Python files stored in ~/storage/shared
, but I'm hoping to increase the flexibility of this setup more.
$HOME/storage
outside of Termux (with a file explorer)?./data/local/tmp/
. That directory misses thex
flag so you can't list it's content but the files were accessible if you knew the path. Not sure about latest Android versions.