How to install sudo in termux

Sudo (superuser do) is a Linux command that allows users to execute commands with the privileges of another user, typically the root user. Termux, an Android terminal emulator and Linux environment app, does not come with sudo pre-installed, but it is possible to install and use it in Termux. Here are the steps on how to install sudo in Termux:

Step 1: Open Termux on your Android device.

Step 2: Update the package list by running the following command:

apt update

Step 3: Install the “proot” package by running the following command:

apt install proot

Proot is a userspace implementation of chroot, which allows users to create isolated environments within a host operating system.

Step 4: Run the following command to create a new root file system:

proot -r $PREFIX/share/TermuxAlpine/ -b /dev/ -b /sys/ -b /proc/ /usr/bin/env -i HOME=/root TERM=$TERM /bin/sh --login

This command installs Alpine Linux, a lightweight distribution of Linux, as a root file system within Termux.

Step 5: Once you are in the Alpine Linux environment, run the following command to install sudo:

apk add sudo

Step 6: Run the following command to add your user to the sudoers list:

adduser [your_username] sudo

Replace “[your_username]” with your Termux username.

Step 7: Run the following command to exit the Alpine Linux environment and return to Termux:


That’s it! You now have sudo installed and can use it to execute commands with elevated privileges.

It is important to note that using sudo can be dangerous and should be used with caution. Be sure to understand the implications of the commands you are executing with sudo and only use it when necessary. Additionally, it is important to keep your Termux installation and any installed packages up to date to ensure the security and stability of your system.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top