Securely connect to Android over the internet using ADB + Tailscale.
You can also copy paste this gist into your agent of choice and have it explain you what to do.
This guide sets up remote ADB access so you can run android-use — an agent skill that lets AI interact with your Android device over ADB.
Install Tailscale on both devices:
- Android: Play Store → login → enable VPN → disable battery optimization
- Ubuntu:
curl -fsSL https://tailscale.com/install.sh | sh && sudo tailscale up
Install ADB (Ubuntu): sudo apt install -y adb
# 1. Enable ADB over TCP (USB required once per reboot)
adb tcpip 5555
# 2. Get Android's Tailscale IP from the app (100.x.y.z)
# 3. Connect from laptop/VPS
adb connect 100.x.y.z:5555
# 4. Accept authorization prompt on Android (check "Always allow")Verify: adb devices → should show 100.x.y.z:5555 device
| Action | Command |
|---|---|
| Reconnect | adb connect <IP>:5555 |
| Switch to USB | adb usb |
| Reset connection | adb kill-server && adb tcpip 5555 |
| Screen mirror | scrcpy (see below) |
| Error | Fix |
|---|---|
connection refused |
Run adb tcpip 5555 on device |
unauthorized |
adb kill-server → reconnect → accept prompt |
no route to host |
Check Tailscale VPN is on, ping the IP |
Mirror and control your Android screen from your laptop:
sudo apt install scrcpy
scrcpy --bit-rate 4M --max-size 1024- ✅ Use Tailscale ACLs to restrict which devices on your network can reach ADB (Admin Console → Access Controls)
- ✅ Enable device key expiry so compromised devices lose access automatically
- ❌ Never expose port 5555 publicly — ADB has no authentication, anyone can connect
- Rooted:
setprop persist.adb.tcp.port 5555 - Non-rooted: Use Termux + Tasker to run
adb tcpip 5555on boot
Once ADB is connected, you can use android-use to let an AI agent control your device — tap, swipe, type, and navigate apps autonomously.