How to Set Up SSH Server on Termux — Remote Shell Access Made Easy
Stephano Kambeta

Stephano Kambeta @terminaltools

About: Cyber security and Ethical hacking teacher

Joined:
Mar 12, 2025

How to Set Up SSH Server on Termux — Remote Shell Access Made Easy

Publish Date: Jul 28
4 0

If you've ever wanted to control your Android device remotely like a Linux server — you're in the right place. With Termux , you can install an SSH server on your phone and connect to it just like any other machine.

Let’s walk through the steps to set up your own SSH server using Termux — no root required.


📲 What You’ll Need

  • An Android device with Termux installed
  • A local Wi-Fi network (or Ngrok for global access)
  • Basic Linux command-line knowledge

You might also want to brush up on:


🛠 Step 1: Install OpenSSH

Open Termux and run:

pkg update && pkg upgrade
pkg install openssh

Enter fullscreen mode Exit fullscreen mode

This will install the ssh client and the sshd daemon.


🔐 Step 2: Set a Termux Password

SSH login requires a user password. Set it like this:

passwd

Enter fullscreen mode Exit fullscreen mode

Use a strong password. You can learn why this matters in this post on brute-force attacks.


🚀 Step 3: Start the SSH Server

Start the SSH daemon with:

sshd

Enter fullscreen mode Exit fullscreen mode

By default, it listens on port 8022, not the usual 22. You can check it with:

ss -nlt

Enter fullscreen mode Exit fullscreen mode

🌐 Step 4: Find Your Local IP

To connect to your phone, you’ll need its local IP address. Get it by running:

ip addr show

Enter fullscreen mode Exit fullscreen mode

Look under wlan0 for something like 192.168.x.x.


💻 Step 5: Connect From Another Device

From your computer or another device on the same network:

ssh -p 8022 your_username@192.168.x.x

Enter fullscreen mode Exit fullscreen mode

You can find your Termux username by running:

whoami

Enter fullscreen mode Exit fullscreen mode

🌍 Optional: Access SSH Over the Internet

Install Ngrok in Termux and run:

ngrok tcp 8022

Enter fullscreen mode Exit fullscreen mode

It will give you a public address like tcp://x.tcp.ngrok.io:xxxxx, which you can SSH into from anywhere:

ssh -p xxxxx your_username@x.tcp.ngrok.io

Enter fullscreen mode Exit fullscreen mode

This is perfect for working on the go, from your PC, or even inside VS Code.


🔒 Secure Your Setup

If you're exposing your Termux SSH to the internet, do not skip security :


⚡ Auto Start SSH on Boot (Optional)

Termux doesn’t support true background daemons, but you can use Termux:Boot or automation apps like Macrodroid to run sshd on boot.

You can also combine this with:


🔧 What Can You Do With This?

SSH opens up huge possibilities:

And more advanced things like:


🧠 Final Thoughts

That’s it! You now have an SSH server running on your Android phone using Termux.

Pair this with your favorite tools from Terminal Tools and your phone becomes a portable Linux hacking box.

Check out these next:


💬 Let’s Talk

Got questions, ideas, or tips? Drop them in the comments. Let’s build smarter Android-powered hacking labs together.

Comments 0 total

    Add comment