0

I have an issue with files permission in termux. For instance I installed c4droid and copied the termux include and lib folders content in the c4droid folder where the headers are being looked for at compilation. I changed the owner and group to the correct name and mode to 777 but at compilation it says "cannot open ****.h permission denied". Same thing with a worldlist that comes from the sd card that I put on a folder meant to be used with hydra, not only have I to use root access to unzip the file and move it around, but hydra itself can't open it. What is this so important thing that I am missing about termux and filed ownership and permissions ?

  • I installed c4droid and copied the termux include and lib folders content in the c4droid folder. And what's the exact location of c4droid folder? – Irfan Latif Jul 2 '19 at 7:53
  • /data/data/com.n0n3m4.droidc/files/gcc/'somethinglikeaarcharm'/ – Yvain Jul 2 '19 at 8:51
  • So you are trying to access /data/data/com.n0n3m4.droidc/ from Termux, right? That won't work. Termux can't read/write data outside its own private directory /data/data/com.termux/. That's the app sandboxing mechanism of Android - for security and privacy. Other possible location which Termux can access is /sdcard/Android/data/com.termux. Also whole /sdcard if you grant Termux Storage permission. – Irfan Latif Jul 2 '19 at 8:54
  • No, i su in termux to put the files in c4droid folder. After that I change the permissions and ownership to the user / group of c4droid and try to compile with this app, not termux – Yvain Jul 2 '19 at 8:56
  • Ok. Did you fix SELinux context of files along with ownership and permission mode? Also there could possibly be hard-code PATHs in haders / libs. Termux packages have source code modified. – Irfan Latif Jul 2 '19 at 8:57
0

Okay, from the above comments, hinting toward SELinux blocking acces to the files that are being copied around to the /data/data/ directory of apps. Yes it is SELlinux blockibg the access, you need just to set it to permissive mode with SELinux_switch and dont forget to set the user and group to the app's one. Thank you. [Edit] Okay so copying the files from termux with the options -pZL keeps everything in place and once you set the correct owner ans group it will work, I have not tried having a symlink from the droidc includes and libs folder to termux's ones. If you missed fixing permission while copying files, you cén use /system/bin/restorecon -R (recurse) one both include and lib folders.

| improve this answer | |
  • Don't set SELinux permissive with SELinux Switcher, it's like turning your back to a security feature in which professionals have spent years to implement. Instead set proper context on your files/directories. If you answer my question in chat, I can try to help you how to do that. If that doesn't work, you can swith SELinux permissive temporarily, not permanently. PS: you don't need an app to do that, just echo 0 >/sys/fs/selinux/enforce – Irfan Latif Jul 2 '19 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.