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

Can't access files on sdcard / termux-setup-storage doesn't do anything #157

Closed
ChristianS99 opened this issue Sep 13, 2016 · 61 comments
Closed

Comments

@ChristianS99
Copy link

Hello,
problem is, that I can't access "/sdcard" and also termux-setup-storage doesn't help and doesn't create the symlinks as described.
My android is 6.0.1 (cyanogen). Maybe there was another change, that broke it?
Or anything else I can do?

@Neo-Oli
Copy link
Member

Neo-Oli commented Sep 13, 2016

  1. Can you check the permissions of the termux app in the app settings (Android Settings -> Apps -> Termux -> Permissions) and see if storage permission is granted or not. If not already granted, flick the switch.
  2. While in the App Settings, press Force Stop, to completely kill Termux. Then restart it and try again.
  3. If it still doesn't work, can you check if you can access /storage/emulated/0 (cd /storage/emulated/0 directly, as you normally can't access /storage/emulated). /sdcard is usually just a symlink to /storage/emulated/0, where the drive is mounted. /sdcard may not exist on some devices.

@ChristianS99
Copy link
Author

Thx, I had to change the storage permission, but I was looking at the wrong place for it and couldn't find it. You Pointed me to the right place and now it works.

@Neo-Oli
Copy link
Member

Neo-Oli commented Sep 13, 2016

Normally termux-setup-storage should open a popup permission granting window. That didn't appear to you? Were you using ssh or telnet to issue the commands?

@ChristianS99
Copy link
Author

yeah, I was using ssh. When I tried locally there was no popup (propably because I had granted permission manually), but the symlinks are created now.

@dandv
Copy link

dandv commented Oct 16, 2017

I have the same problem on a Galaxy S7 running SuperMan-ROM.

I had granted termux storage permission manually, then ran termux-setup-storage per the instructions just in case. The symlinks on ~/storage exist, but the external folder is called external-1.

@Quasic
Copy link
Contributor

Quasic commented Oct 16, 2017

@dandv, where does external-1 point? It should be empty when first created. ls -l ~/storage

Nvm, missed your edit. You can rename the symlinks.

@Quasic
Copy link
Contributor

Quasic commented Oct 18, 2017

I was e-mailed another reply, but don't see it. To support multiple SD cards, external now has a number attached. It points to an empty directory created for Termux on the SDcard. Termux can't always access the whole SDcard. My phone lets it read the whole card, basically, via /storage/external_SD but not make any changes, except in its special folder: /storage/external_SD/Android/data/com.termux/files which is why ~/storage/external* points there instead of to the SDcard root directory.

@Subhash3
Copy link

I'm presently in home directory i.e. $HOME.
by executing cd .. /.. /.. /.. we can directories /, /data, /data/data
But I'm unable to open these directories.. Plz help

@Quasic
Copy link
Contributor

Quasic commented Nov 8, 2017

@Subhash3, if I understand correctly, you are trying to find the path to your SD card. My path is under /storage/, which I can open. There is also a /sdcard/, but it is linked to /storage/emulated/legacy/

@SDRausty

This comment was marked as spam.

@Sk8793
Copy link

Sk8793 commented Nov 22, 2017

mv: cannot move '/data/data/com.termux/files/home/Tmux-Bunch/binder/is.apk' to '/data/data/com.termux/files/home/metasploit-framework/is.apk': Permission denied
even I can't move copy any files..how can I fix this?

@Quasic
Copy link
Contributor

Quasic commented Nov 23, 2017

@Sk8793, this isn't SDcard related, is your phone rooted? Try ls -l to find the permissions of each folder.

@SDRausty

This comment was marked as spam.

@Subhash3
Copy link

Subhash3 commented Nov 24, 2017 via email

@Subhash3
Copy link

Subhash3 commented Nov 25, 2017 via email

@SDRausty

This comment was marked as spam.

@Subhash3
Copy link

Subhash3 commented Nov 26, 2017 via email

@Subhash3
Copy link

Subhash3 commented Nov 26, 2017 via email

@SDRausty

This comment was marked as spam.

@Quasic
Copy link
Contributor

Quasic commented Nov 26, 2017

It sounds like you want to use adb or root...

@sagittariusjr
Copy link

Hi, a have problem with opening file. I have permision to storage, but if I want to open file or anythink, he write " bash: ./download/od.pdf: Permission denied".

@pulketo
Copy link

pulketo commented Oct 9, 2018

Hi, a have problem with opening file. I have permision to storage, but if I want to open file or anythink, he write " bash: ./download/od.pdf: Permission denied".

  1. You are trying to execute a file, try opening instead!!
    for example: pdftotext /download/od.pdf
  2. i think you are not in the correct path, try /sdcard/Download/od.pdf
    for example: pdftotext /sdcard/Download/od.pdf

@sagittariusjr
Copy link

Hi, a have problem with opening file. I have permision to storage, but if I want to open file or anythink, he write " bash: ./download/od.pdf: Permission denied".

  1. You are trying to execute a file, try opening instead!!
    for example: pdftotext /download/od.pdf
  2. i think you are not in the correct path, try /sdcard/Download/od.pdf
    for example: pdftotext /sdcard/Download/od.pdf

It's ONLY example, I can't open anythink, like foto or file after compilation in C

@Grimler91
Copy link
Member

You can't run a pdf as if it was a bash script. bash /sdcard/Download/od.pdf expects od.pdf to contain bash commands.

To open it in another application, do xdg-open /sdcard/Download/od.pdf.

@sagittariusjr
Copy link

You can't run a pdf as if it was a bash script. bash /sdcard/Download/od.pdf expects od.pdf to contain bash commands.

To open it in another application, do xdg-open /sdcard/Download/od.pdf.

$ gcc test.c -o test
$ ./test
bash: ./test: Permission denied

@ghost
Copy link

ghost commented Oct 10, 2018

You can't execute binaries on /sdcard. Do this in $HOME instead. Just a file system limitation and we can't do anything with that.

To open file you need to use command 'cat'.

@sagittariusjr
Copy link

Where Is directory $HOME? Can i find her in file Explorer?

@Grimler91
Copy link
Member

If you don't know what $HOME is then I strongly suggest that you look for a linux guide for beginners on some search engine and learn the basic stuff

@wolfwar22

This comment has been minimized.

@wolfwar22

This comment has been minimized.

@Subhash3
Copy link

@wolfwar22
Just type the absolute path of the pass.txt file.
OR
Navigate to the directory where pass.txt is located in and try the same command you tried.

Copy Command:
cp source destination

Here source can be the absolute path of the source file or relative path of the source file.
Absolute path works always. But if you just want to type the name of the file (Don't want to type the entire absolute path), then just navigate to the directory where the source is located in.
Same in case of destination also.

@Subhash3
Copy link

I know what is $HOME, but I don't know where Is that directory on Android

$HOME is a directory in all the Linux platforms. It is also denoted by ~.
To navigate to that directory
--> cd
--> cd $HOME
--> cd ~
All the three above should work.

Coming to the point, even I can't see the home directory in GUI file explorers. But it is there in all the file systems. It is possible to make some other directory as your home directory so executing any of the three commands above navigate you to that directory.

@pulketo
Copy link

pulketo commented Dec 12, 2018

I know what is $HOME, but I don't know where Is that directory on Android

$HOME is a directory in all the Linux platforms. It is also denoted by ~.
To navigate to that directory
--> cd
--> cd $HOME
--> cd ~
All the three above should work.

Coming to the point, even I can't see the home directory in GUI file explorers. But it is there in all the file systems. It is possible to make some other directory as your home directory so executing any of the three commands above navigate you to that directory.

could you explain with a short video what are you trying to do? if you can't "see" $HOME then you should reinstall termux

@ghost
Copy link

ghost commented Dec 12, 2018

Coming to the point, even I can't see the home directory in GUI file explorers.

could you explain with a short video what are you trying to do?

Applications like https://play.google.com/store/apps/details?id=com.estrongs.android.pop can't see /data/data directories without root.

@vkuehn
Copy link

vkuehn commented Dec 14, 2018

same issue here on different devices (mainly samsung)
I can create that folder
/data/data/com.termux/files/home/storage/external-1/sicher/programing/python/test
but when I do
python -m venv ./venv
in test I get this
Error: [Errno 1] Operation not permitted: 'lib' -> '/storage/0B4B-84D9/Android/data/com.termux/files/sicher/programing/python/test/venv/lib64'
STorage permissions to Termux a granted and termux has been restarted a couple of times
any hint why I can create folders but fail with python ?

@ghost
Copy link

ghost commented Dec 14, 2018

@vkuehn It is not possible to have symlinks and executables on sdcard, regardless if it is internal or external. Just remember this!

There many times was asked such questions related to permissions on sdcard. Also, check the FAQ on Termux Wiki.

@Dimzzz
Copy link

Dimzzz commented Jul 21, 2019

In termux:
pkg install python
cd file/dir/
python - m http.server

In browser:
localhost:8000/

open file and download one.

@Dicer-TDP
Copy link

What the code registration ext. Sdcard? How I can do for opened this external storage?

@Likhith46
Copy link

I created apyaload but when I try to copy it to discard I cannot find that payload .I used cp /sdcard

@EmTee70
Copy link

EmTee70 commented Oct 14, 2019

Hello,
problem is, that I can't access "/sdcard" and also termux-setup-storage doesn't help and doesn't create the symlinks as described.
My android is 6.0.1 (cyanogen). Maybe there was another change, that broke it?
Or anything else I can do?

I found the following: I opened the file manger and searched for the 'Camera' path with my images, than I saw, where they are located on my sd card: The path was /storage/52A9-7AFA/
probably individually for me. But I can access this path via termux. (It is not linked at $HOME/storage/external-1). Hope this helps someone else.

@Quasic
Copy link
Contributor

Quasic commented Oct 14, 2019

termux-setup-storage only puts folders with read access for termux in ~/storage. Termux probably doesn't have read access to root folders of the sdcard, so I added a symlink ln -s /storage/$sdcardid sdroot where sdcardid= something like {4 hex digits}-{4 hex digits} in my home directory for accessing read-only sdcard files.

@reedniv
Copy link

reedniv commented Oct 29, 2019

If you want find sdcard just input " cd storage/shared" this a sdcard directory. I hope can help you

@ghost
Copy link

ghost commented Jan 26, 2020

  1. Make sure Storage permission is given to Termux in Settings
  2. You internal Storage is located under "/storage/emulated/0"
  3. Out of those 3, only directory "0" is accessible, for "storage" and "emulated", you need to root your device.
  4. Directory "0" can also be accessed by "/sdcard/", "/sdcard/" refers to "/storage/emulated/0"
  5. Type termux-setup-storage to create symlinks to /sdcard/ or /storage/emulated/0
  6. Only if you do that you will be able to access "0", as for directories like "storage" and "emulated", you need to root your device.
    -END-

@ghost
Copy link

ghost commented May 1, 2020

How I fix that ?

What to fix ? I don't see any error on your screenshot.

termux-setup-storage creates stuff under ~/storage directory (which is seen on your screenshot), not in $HOME.

@ghost ghost deleted a comment from Aman151515 May 10, 2020
@x011
Copy link

x011 commented Jun 20, 2020

Run the following as the default termux user:

cd ~
tsu 
rm storage
exit
termux-setup-storage

@Vreat
Copy link

Vreat commented Aug 11, 2020

Please someone help me I am having problems with my storage anytime I I input command and is it shows no such commands can anyone help

@hussienfleece
Copy link

Heloo guys please I need your help. My android version is 10. Ever since last week that I've been trying to access my internal storage from termux it's denying. I don't have an sd card. I had granted permission to the app in my settings. But still it keeps showing "no such file in directory" in my internal storage!!! Pls I need your helpy guys.???????

@ghost
Copy link

ghost commented Nov 7, 2020

Have you tried termux-setup-storage?

@hussienfleece
Copy link

Yes I tried but still no solution

@ghost
Copy link

ghost commented Nov 8, 2020

I think your device hits the scoped storage restriction. on my Android 10 Device. Termux still has Access to /sdcard.

@hussienfleece
Copy link

The thing is that I don't have an SD card

@hussienfleece
Copy link

So what do you guys suggest I should do ?

@ghost
Copy link

ghost commented Nov 8, 2020

I think your device hits the scoped storage restriction. on my Android 10 Device. Termux still has Access to /sdcard.

@wmcb-tech Where you got info that this is case of @hussienfleece ?

But still it keeps showing "no such file in directory" in my internal storage!!!

@hussienfleece The reason why it tells "no such file..." is because you are using the wrong path. File just not exists in current directory or in directory you are typing.

My advice is to follow https://wiki.termux.com/wiki/Internal_and_external_storage#Access_Termux_from_file_manager and put your file directly in Termux home directory.

@ghost
Copy link

ghost commented Nov 8, 2020

I was confused at first. but thanks for the information. 😅. i thought the internal sd card or the external sd card

@ghost
Copy link

ghost commented Aug 16, 2021

I have a solution first go to settings and deny files permission of termux and then run termux-setup-storage and allow permission

@ghost ghost locked and limited conversation to collaborators Oct 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests