Skip to content

Instantly share code, notes, and snippets.

@GabrielMMelo
Created January 22, 2019 12:33
Show Gist options
  • Select an option

  • Save GabrielMMelo/0e146f32d73978bf0d0a06786bcbc96c to your computer and use it in GitHub Desktop.

Select an option

Save GabrielMMelo/0e146f32d73978bf0d0a06786bcbc96c to your computer and use it in GitHub Desktop.
Install sudo in Termux (Android)
apt install git
git clone https://gitlab.com/st42/termux-sudo
cd termux-sudo
cat sudo > /data/data/com.termux/files/usr/bin/sudo
chmod 700 /data/data/com.termux/files/usr/bin/sudo
@VesperQuartz
Copy link

I added this and it fixed my issue
elif [ -x $(which su) ]; then SU=$(which su)

@ishitasingh678
Copy link

Uploading Screenshot_2025-07-19-20-38-05-85_84d3000e3f4017145260f7618db1d683.jpg…

@ishitasingh678
Copy link

su executable not found
sudo requires su

Pls help

@ishitasingh678
Copy link

su executable not found
sudo requires su

Pls help I did above all but still occurring this error

@armm29393
Copy link

pkg install sudo
It's worked!

@Luna1234julie
Copy link

Stiller on kt on m'y zfold 4 not rooted
Please help

@ilyaigpetrov
Copy link

ilyaigpetrov commented Oct 10, 2025

If you just need to execute sudo apt [...] then:

alias if-termux='[[ ! -z $TERMUX_VERSION]]' # If the var is not empty.
# Define `sudo` as no-op if inside Termux:
if-termux && alias sudo=''
# Update information about packages:
sudo apt update
# Upgrade all installed packages to the latest versions:
sudo apt upgrade
# Install Python programming language interpreter, version 3:
sudo apt install python3

@ahma78
Copy link

ahma78 commented Nov 22, 2025

Mihkhh

@ahma78
Copy link

ahma78 commented Nov 22, 2025

Oouu

@Legoscratch
Copy link

Does anybody know if this has been patched in Android 16 as I've tried basically everything in this thread but it says:

Termux does not supply tools for rooting

and I don't really know much about termux to be honest but has anyone found any new solutions?

Any help would be appreciated, (also I got it to work on my old phone but it was Android 14, which is why I think it might be an issue with Android 16)

@ilyaigpetrov
Copy link

@Legoscratch, maybe you can use https://wiki.termux.com/wiki/PRoot or the official Virtual Terminal app shipped by Google with the recent versions of Android 16 since 2025.

@Legoscratch
Copy link

@ilyaigpetrov Sorry for getting back so late, but thanks so much! This is great and works excellently on my Pixel, even has the ability to run GUI applications!!

@LeonGinger
Copy link

now this way is not work in Android15,my phone is install magisk-modules ,root and unlock bl,Android14/15, end if you can use "su" command,in temrmux you just need
cat > $PREFIX/bin/sudo << 'EOF' #!/system/bin/sh su -c "$@" EOF

chmod 755 $PREFIX/bin/sudo

and test
sudo id

.../ $ sudo id uid=0(root) gid=0(root) groups=0(root) context=u:r:magisk:s0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment