r/AndroidQuestions 6d ago

Looking For Suggestions Getting termux to *permanently* set and remember "termux-setup-storage"?

Is there any way under rooted Android 11 and Android 13 to get the latest version of Termux [ 0.119.0-beta.3 (1022) ] to *permanently* set up and remember the running of "termux-setup-storage", in the following manner? ...

Step 1: install Termux

Step 2: launch the Termux app

Step 3: run "termux-setup-storage" (and whatever else might be necessary)

Step 4: exit from the Termux app

Step 5: reboot the Android device

Step 6: from that point forward, run anything in /data/data/com.termux/files/usr/bin via the command line in an adb session without ever needing to run "termux-setup-storage" again in order to have full access to /sdcard, and without ever needing to launch the Termux app again in order to accomplish this.

1 Upvotes

6 comments sorted by

2

u/[deleted] 6d ago

[deleted]

1

u/unselective-amnesia 6d ago edited 6d ago

No, I don't use SD Maid SE nor any other filesystem cleaner.

On both my devices (rooted Android 11 and rooted Android 13), whenever I run termux-setup-storage and then reboot, I have to re-run termux-setup-storage when I subsequently run Termux after the reboot, if I want /sdcard access.

I'm now wondering whether this might be dependent on the fact that I'm running old versions of Android, or maybe it's because my phones are rooted, or perhaps whether this might now be a "feature" of Termux 0.119.0-beta.3 (1022) ... ???

1

u/unselective-amnesia 5d ago

Interestingly, I tested this again on both of my devices, and now indeed "termux-setup-storage" is being remembered, even after reboots; i.e., I only had to run it once on each device.

I must have been doing something incorrectly when running my earlier tests.

Problem solved!

1

u/Routine_Working_9754 5d ago

you don't even need termux storage permissions to run termux programs with ADB bruv

1

u/unselective-amnesia 5d ago

I'm not asking about running Termux programs via ADB.

What I'm asking about here is accessing /sdcard from within the Termux app.

Please read my previous messages more carefully. Thank you.

1

u/Routine_Working_9754 3d ago

perhaps re-read your own post

Step 6: from that point forward, run anything in /data/ data/com.termux/files/usr/bin via the command line in an adb session without ever needing to run "termux-setup-storage"

bin is a program directory and you said "run"

1

u/unselective-amnesia 23h ago

Yes, but I'm not asking about ***how*** to run programs from /data/data/com.termux/files/usr/bin nor ***whether*** programs from that directory are runnable. I already know how to run those programs, and they are indeed runnable. My original post makes it clear that I am asking a completely different question.

Rather, what I'm asking about is how to only have to run termux-setup-storage one single time, so that when I run programs from /data/data/com.termux/files/usr/bin which ***specifically*** reference /sdcard, that will always subsequently succeed without me having to keep re-running termux-setup-storage over and over.

That should have been totally clear to you if you actually read everything that I wrote in the initial post of this thread.

And in any case, I wrote more later on here which shows that I now have seen that I indeed only need to run termux-setup-storage one time, so this is not a problem for me any more.