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
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
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
By default, it listens on port 8022
, not the usual 22
. You can check it with:
ss -nlt
🌐 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
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
You can find your Termux username by running:
whoami
🌍 Optional: Access SSH Over the Internet
Install Ngrok in Termux and run:
ngrok tcp 8022
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
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 :
- Use strong passwords or SSH keys
- Avoid default ports
- Monitor connections (
tail -f ~/.ssh/sshd.log
) - Learn about:
⚡ 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:
- Use your Android as a remote Linux box
- Access and edit files remotely
- Install and run Nmap or Zphisher from your laptop
- Run scripts, bots, or phishing tools like:
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.