This site runs best with JavaScript enabled.SSH into Termux from Your Computer

SSH into Termux from Your Computer

April 06, 2021

––– views

The other day, I was debugging something on my Android phone (Pixel 2). Instead of typing on the phone, I thought it would be easier to SSH into Termux from my laptop.

It took me a while to get everything working so I figured I'd write up a post to help me remember next time (and hopefully help you!).

Follow these steps:

  1. Open Termux on your Android phone
  2. Install OpenSSH:
    pkg upgrade
    pkg install openssh
  3. Set up a password:
  4. Find your username by running this in Termux:
    Save this value for later. Might look like u0_a254
  5. Find the host by running this in Termux:
    Look for something like inet addr: Save this value for later.
  6. Start the ssh server on Termux:
    Verify that it's running with:
    logcat -s 'ssh:*'
    You should see something like "Server listening on port 8022"
  7. On your computer, SSH into your machine on port 8022 (default port):
    ssh <username>@<host> -p8022
  8. Type in your password and viola! You're accessing Termux from your computer.

Additional Resources

These are the resources that helped me figure this out and might provide more context.

Discuss on TwitterEdit post on GitHub

Share article

Join the Newsletter

I send a couple emails per month related to programming and learning. I also share goodies and deals here.

Help others learn to code