Connecting to Your Android Termux Instance via ADB and SSH
Requirements
- A wire to connect your phone and PC for localhost or local network access
- ADB (Android Debug Bridge)
- Termux
- OpenSSH
Setting Up OpenSSH in Termux
-
Install OpenSSH:
pkg install openssh -
Start the SSH daemon:
sshd
Connecting the Devices via Wire or Local Network
In Termux
-
Set a password for your SSH connection:
passwd
On Your PC
-
Check connected devices:
adb devices -
Forward the ADB connection:
adb forward tcp:8022 tcp:8022Output should indicate the forwarding, e.g.,
>>> 8022. Accept the ADB connection on your phone when prompted.
Final Connection
-
Again, on your PC, establish the SSH connection:
ssh localhost -p 8022 Enter the password you set earlier when prompted.
Now you should be connected to your Android Termux instance!