A bash script to install the sudo functionality in termux.
Requirements
The device must be rooted else this will not work.
Installing sudo
- Open termux
- Execute this command
wget https://raw.githubusercontent.com/xicor22/Sudo-su-Termux/master/install.sh >/dev/null 2>&1 && chmod +x install.sh && ./install.sh
- Done!
Features
- Sets up its environment automatically on first run, no need to do anything but use it
- Creates a root folder
.suroot
in the Termux home folder with proper root permissions and ownership - Creates
.bashrc
file in root folder with proper PATH and LD_LIBRARY_PATH variables set so all binaries function correctly - Bash prompt PS1 variable is also set so you don't have
bash-4.4#
as prompt just#
- Automatically creates
.bash_history
in root folder when you drop to a root shell so root shell history is preserved - Can be used like ordinary sudo (but only as root, no other user)
- Can drop to root shell
sudo su [-]
- Runs built in Termux binaries and exteral binaries with optional arguments as root in current directory
- Generates output in shell currently using
- Can be used in other bash scripts
Usage:
sudo su [-]
Drop to root shell
sudo <command> [<args>]
Run command as root with optional arguments
This was inspired by the following: