Accessing termux user environment from other consoles I've recently started using the amazing Termux terminal app and linux environment.  It provides a wealth of full-function terminal utilities.  It would be great to be able to access these utilities from other consoles, especially when connected via ssh or adb shell.  I've managed to make some functionality available by setting my PATH and LD_LIBRARY_PATH environment variables to the same values used by Termux's shell, but there are permissions problems and it seems messy.

Is there a way to ssh in to a Termux session?  Termux doesn't seem to provide an ssh server package.  Even if it did, presumably that server, and thus the ssh session granted by it, would run as a separate user from the termux user, resulting in similar permissions problems.

Is there a supported way to access the Termux user environment from other consoles?
Termux does provide the openssh package, which contains both the ssh client and the sshd server.

Install the package with: apt install openssh, then start the server with sshd - it will run on port 8022 by default, so connect to it with ssh -p 8022 DEVICE_IP, and you can find the device wifi ip using ip addr list wlan0.

Password authentication is not supported, so you need to setup $HOME/.ssh/authorized_keys.

After you have connected you will run as the normal Termux user with environment variables setup correctly.