Termux-app: permission denied sudo tsu

Created on 30 Jun 2018  Â·  17Comments  Â·  Source: termux/termux-app

My phone is rooted but can't access root on termux
tsu

ls

bash: /data/data/com.termux/files/usr/bin/applets/ls: Permission denied
$ sudo su

ls

tsu

ls

bash: /data/data/com.termux/files/usr/bin/applets/ls: Permission d

Most helpful comment

Well, it is very good to see that you solved it but it would be much more helpful if you posted the solution too, because this is a public-viewed thread

All 17 comments

Use tsu -a instead of just tsu.

tsu -a
bash: /data/data/com.termux/files/usr/bin/tsu: /data/data/com.termux/files/usr/bin/sh: bad interpreter: Permission denied
Still getting the same error

Are you still having this issue? What root management app are you using? (Magisk, SuperSU... hopefully not KingRoot, etc.)

First of all there is no "sudo" command in Android... unless you put it in the system yourself, but even then it doesn't work well with Android. The command to go to root is just "su" You can pass commands to root (say you want to view all networking processes with netstat) using "su -c netstat -tuepa"

I'm assuming you installed tsu and have upgraded your packages in Termux (apt install tsu && apt update -y && apt upgrade -y)

Invoking su should give you a root shell on the phone, but without access to Tmux packages (that's what tsu is for.) If su says permission denied, then your root control app isn't allowing root access to Termux. I recommend Magisk... it's open source, kept up-to-date and easily flashed from recovery (like TWRP.)

Are you on old Android ≤5? If so, tsu has issues with LD_LIBRARY_PATH; but su will always work if you have correctly rooted your device. I'm betting your root management app is not allowing termux root access... if you're using KingRoot, they block termux to make it harder for you to remove kingroot (as it's spyware.) Check your root management app to make sure it isn't kingroot and is allowing Termux root access.

@setuidroot Most android devices (without custom rom installed) have a such thing as SELinux. It can restrict permissions for all users including root. So:

Are you still having this issue?

Run apt install <some packages> and you will mess up all selabels (not only ownership) and will get permission denied when accessing files.

Solutions for this are:

  1. setenforce 0 - disable SElinux enforcing
  2. restorecon -R /data/data/com.termux

Read Termux Wiki/FAQ about this: https://wiki.termux.com/wiki/FAQ

Are you on old Android ≤5

Termux does not support Android less than 5. Even if user will be able to install applicantion, cli programs will not work.

@xeffyr I should have been more clear in my post, I just didn't want to make it too long. I should have added in that you should NEVER update/upgrade or do any apt/dpkg package management whilst running as root. This will screw everything up as far as ownership. Generally I've fixed this with chown -R (tmuxuser) /data/data/com.termux/files/usr. But I should have said not to run apt as root. I just assumed that @inzamamraja couldn't get root access at all.

As far as SELinux... that gets messy. You can disable it, like you said; but I wouldn't normally recommend people run without SELinux unless they really know what they're doing. That opens the possibly for any app to gain access outside of it's allowed permissions. I've never run into termux issues with SELinux unless doing things like packet sniffing/injection. But I realize this is highly device and OS dependent.

I wasn't aware termux doesn't work on android less than 5 (I dont have any devices less than 5.) I have a bootloader locked galaxy s5 running android 5 that has issues with tsu and LD_LIBRARY_PATH; Grimler91 has some good insight on that here: https://github.com/termux/termux-packages/issues/2047

I don't know what OP's issue is... if he can get root with su, but not tsu? Or no root at all? If he replies with more info maybe we can help him further. Either way, I appreciate all you guys that contribute so much to termux :)

solved

Well, it is very good to see that you solved it but it would be much more helpful if you posted the solution too, because this is a public-viewed thread

How did you resolve the issue.

hi
How to solve this permissions
/data/data/com.termux/files/usr/bin/tsu: 144: exec: : Permission denied

The same as above: how?
Comments like 'solved' and closing the issue, won't help next people at all in the future.
Thank you in advance for help.

at the start of the termux window... ,
$ su
and you move to=
$root@device # /data/data/com.termux/files/home #

the termux was just updated from google play and then came with the problems. when open it, there're info as below, and nothing can do, except enter to quit.

CANNOT LINK EXECUTABLE "cat": library "libandroid-support.so" not found
CANNOT LINK EXECUTABLE "realpath": library "libandroid-support.so" not found
/data/data/com.termux/files/usr/bin/login: 27: exec: : Permission denied

[Process completed (code 126) - press Enter]

what can I do?

@setuidroot Most android devices (without custom rom installed) have a such thing as SELinux. It can restrict permissions for all users including root. So:

Are you still having this issue?

Run apt install <some packages> and you will mess up all selabels (not only ownership) and will get permission denied when accessing files.

Solutions for this are:

  1. setenforce 0 - disable SElinux enforcing
  2. restorecon -R /data/data/com.termux

Read Termux Wiki/FAQ about this: https://wiki.termux.com/wiki/FAQ

Are you on old Android ≤5

Termux does not support Android less than 5. Even if user will be able to install applicantion, cli programs will not work.

i just signed to pay my respect thanks that fixed my issue where almost lost hope .

@setuidroot Most android devices (without custom rom installed) have a such thing as SELinux. It can restrict permissions for all users including root. So:

Are you still having this issue?

Run apt install <some packages> and you will mess up all selabels (not only ownership) and will get permission denied when accessing files.

Solutions for this are:

  1. setenforce 0 - disable SElinux enforcing
  2. restorecon -R /data/data/com.termux

Read Termux Wiki/FAQ about this: https://wiki.termux.com/wiki/FAQ

Are you on old Android ≤5

Termux does not support Android less than 5. Even if user will be able to install applicantion, cli programs will not work.

@setuidroot Most android devices (without custom rom installed) have a such thing as SELinux. It can restrict permissions for all users including root. So:

Are you still having this issue?

Run apt install <some packages> and you will mess up all selabels (not only ownership) and will get permission denied when accessing files.

Solutions for this are:

  1. setenforce 0 - disable SElinux enforcing
  2. restorecon -R /data/data/com.termux

Read Termux Wiki/FAQ about this: https://wiki.termux.com/wiki/FAQ

Are you on old Android ≤5

Termux does not support Android less than 5. Even if user will be able to install applicantion, cli programs will not work.

After entering this command i got an error
setenforce: command not found

@Divyansh-bot Because setenforce is /system/bin/setenforce. Under su it should be accessible directly.

@Divyansh-bot Because setenforce is /system/bin/setenforce. Under su it should be accessible directly.

yepp!! i got that. thanks!
Hey , i have one more issue how can i give root permission to termux, or , how i can run any command under root permission?

Was this page helpful?
0 / 5 - 0 ratings