AndronixOrigin icon indicating copy to clipboard operation
AndronixOrigin copied to clipboard

Not an issue, but an idea to run the Linux as a USER, not as ROOT by default

Open freebrowser1 opened this issue 3 years ago • 3 comments

When Andronix installs a Linux distro, it runs flawlessly, but it is run as root (i.e. not the actual Android root as it runs on non-rooted devices, but the 'fake root' of the proot application. Despite some apps (e.g. Freetube) won't run at all or at leasy you are running it as root.

Here a tip to run Linux apps as a user rather than root. Run ~/start-ubuntu.sh from Termux. Then a new 'root' shell is started and run:

adduser myuser

Add a line to /etc/sudoers :

myuser ALL=(root) NOPASSWD: ALL

and run chmod -R 0440 /etc/sudoers* Otherwise sudo won't work if you are within the Linux distribution and run sudo when really needing 'root' commands.

*startubuntu.sh:

#!/data/data/com.termux/files/usr/bin/bash
~/start-ubuntu.sh vncserver-stop
pkill ssh-agent* && pkill gpg-agent*
# When running Android 12 or higher (and you are rooted with *real* android root), set the max number of processes over 32:
    sudo /system/bin/device_config put activity_manager max_phantom_processes 2147483647
    # turn off SELinux of Android
    sudo setenforce 0
##
pulseaudio --start
~/start-ubuntu.sh vncuser &
  • stopubuntu.sh:
~/start-ubuntu.sh vncserver-stop
pkill ssh-agent* && pkill gpg-agent*
killall -9 gpg-agent proot Xtigervnc
pkill pulseaudio

These can be put in .shortcuts/Andronix which allows them to be shown in Termux widget so can be started from a widget on Android rather than as a command.

The extra command 'vncuser' should be put into the folder /usr/local/bin (e.g. ~/ubuntu20-fs/usr/local/bin in Termux in the case of Ubuntu 20) in the distro folder, where vncserver-start and vncserver-stop reside. It contains:

#!/usr/bin/env bash

export USER=myuser
export HOME=/home/myuser

 su -c 'HOME=$HOME && cd $HOME && vncserver -name remote-desktop -geometry 1280x720 -localhost no :1' $USER
#original command: 
# vncserver -name remote-desktop -geometry 1280x720 -localhost no :1

Tested succesfully under Android 10 on One+ 6 and under Android 12 (API 31) on Android Studio ARM version (Mac M1). Both are rooted, but that is only needed for the two extra commands for disabling SELinux and turning off the maximum process limit which is optional.

Have fun !

freebrowser1 avatar May 01 '22 14:05 freebrowser1

you can just replace the /bin/bash --login with /usr/bin/login…

dontknowhy avatar Jun 18 '22 09:06 dontknowhy

you can just replace the /bin/bash --login with /usr/bin/login…

Then you have to run sudo unminimize and re do the system pkgs over as a user. Now I wonder doing this, how much might break... hmm

I don't understand why Linux distros under Andronix aren't being run as a user, the normal desktop Linux way, instead of root?

Hmm ;/

0pLuS0 avatar Oct 26 '22 00:10 0pLuS0

They reserve this feature to premium users with modded os

Fede2782 avatar Jan 05 '24 17:01 Fede2782