On LineageOS 23.2 with Magisk is there something similar to `/etc/sudoers`, such that I can run only a given command as `root` on Termux?
2/2
Apr 12, 12:26pm
On LineageOS 23.2 with Magisk, you don’t have a traditional /etc/sudoers file (since Android is not a full Unix system), but you can achieve similar functionality for running specific commands as root from Termux using the following approaches:
1. Using sudo in Termux
Termux can install a sudo package, which allows you to run commands as root if you have Magisk installed (which provides root access).
Steps:
Install sudo in Termux:
bash
pkg install tsu
tsu is a Termux-specific sudo alternative.
Add a Rule for Specific Commands:
Edit the sudoers file for Termux (located at /data/data/com.termux/files/usr/etc/sudoers).
Add a line like this to allow a specific user (e.g., u0_a123) to run a specific command as root: