This page describes how to set up a termux ssh server running as root by using solely adb root, without needing any other rooting app (such as Magisk, SuperSu, Kingroot, ...)
In order to do this, your phone or tablet needs to have USB debugging and root USB debugging enabled.
Settings->About tablet
and tap 7 times
on Build number
to enable Developer options
Settings->System->Developer options
and
enable both USB debugging
and Rooted
debugging
~/.ssh/authorized_keys
Once your phone is ready, connect it with an USB cable to your computer, download the script, and run it.
What the script does:/bin/start-ssh-root_D
) to start
the ssh server, listening on port 8122
Just connect to port 8122 on the tablet or phone:
ssh -p 8122 mydevice
If you've included the phone or tablet's own ssh public key into
~/.ssh/authorized_keys
, you can even connect from the
device to itself to acquire root:
ssh -p 8122 localhost
USB debugging
and Rooted debugging
, and the rooted ssh still continues
to work. The ssh server continues to work even after a LineaOS
upgrade, thanks to a /system/addon.d script
Unable to shield host key
when starting it),
see https://gitlab.com/LineageOS/issues/android/-/issues/6546