Coder Social home page Coder Social logo

termux-sudo's Introduction

termux-sudo

A bash script that provides sudo for Termux
Termux is a terminal emulator and Linux environment for Android

Requirements

Rooted phone with su binary
SUDO WILL NOT WORK WITHOUT SU

Installing sudo

  1. Download sudo to phone and extract
  2. Open Termux
  3. Install a dependency needed for sudo: pkg install ncurses-utils
  4. Change to extraction directory
  5. Execute the following commands to place sudo into the correct directory with the proper permissions and ownership
cat sudo > /data/data/com.termux/files/usr/bin/sudo
chmod 700 /data/data/com.termux/files/usr/bin/sudo

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
  • [option] Can turn off colored error messages be editing the variable colored at the beginning of sudo file
Usage:

sudo su [-]  
  Drop to root shell

sudo <command> [<args>]  
  Run command as root with optional arguments

This was inspired by the following:

https://github.com/cswl/tsu
https://gist.github.com/cswl/cd13971e644dc5ced7b2

termux-sudo's People

Contributors

jaduncan avatar programmerino avatar st42 avatar t-vk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.