adb-relay
Remote adb to your own Android phone from anywhere: the phone calls out over your VPN through mutual TLS. No open ports, a per-project command log, auto-close.
Obtainium installs the app from its releases and keeps it updated. Or download the latest APK.
Gallery
About
Sourced from arikw/adb-relay README
Remote adb to your own Android phone, from anywhere, without opening a single port on the phone.
The phone calls out to your computer over your VPN, through a mutually-authenticated TLS tunnel, and joins
that call to its own adb. Tools on the computer then use plain adb as if the phone were plugged in, whether
the phone is on your home Wi-Fi, someone else's Wi-Fi, or mobile data.
It was built for a devcontainer where several coding sessions (and AI agents) need to install and debug apps on one real phone, with the owner able to see, at a glance, who ran what.
How it works
computer (devcontainer) phone
┌──────────────────────────────┐ ┌────────────────────────────────────┐
│ your tools │ │ adb-relay app (foreground service) │
│ └─ phone <project> <adb…> │ │ │ guards 127.0.0.1:5555 │
│ │ │ VPN, mutual TLS │ │ logs every adb service │
│ adb-relay-adb (adb server) ──┼── 127.0.0.1:5557 │ ▼ │
│ │ adb-relay-socat ◄─┼── calls out to :7000 ─► adbd :5555 │
└──────────────────────────────┘ └────────────────────────────────────┘
app/— the Android app. A foreground service dials the computer, wraps the call in TLS 1.3 with a client key that lives in the Android Keystore, and copies bytes between that call and adbd on127.0.0.1:5555. It also guards that port, closes adb after idle time, approves a new computer key, and keeps a log of what ran. Plain Java, no Gradle, no libraries.relay/— the relay container (adb-relay-socat). Accepts the phone's call on port 7000 (mutual TLS: only the app's key gets in) and hands it to the first adb client on127.0.0.1:5557. A new call replaces the old one, so a dead call never blocks a reconnect.adb/— the adb server container (adb-relay-adb). The one adb server every tool shares. Its key is made fresh on each start and lives only in memory.phone <project> <adb args>isadbaimed at the phone that also tells the app which project is asking.scripts/— opening adb after a phone reboot, and a long-running check.
Security model
- Nothing on the phone accepts connections from the network. adbd listens on port 5555, but two firewall rules (put back by the app after every boot) drop connections from outside the phone and refuse every app inside the phone except this one. After a reboot adb stays closed until the computer opens it once.
- Both ends authenticate. The relay accepts only the app's certificate; the app accepts only the relay's certificate (confirmed by you, by fingerprint, on first contact). A wrong address or a stranger on the network gets nowhere and can't disconnect the phone.
- adb's own keys still apply. The computer's adb key must be approved on the phone. Because the computer's key is kept only in memory, every restart brings a new key, which the owner approves in the app after comparing fingerprints. The app then removes the previous computer key, so only one is ever trusted.
- Visible and bounded. A notification shows the line's state; a pop-up appears when work starts (naming the project); the app's log lists every shell command, install, push and pull; adb closes itself after a chosen idle time.
- Secrets stay out of git. TLS keys (
relay/tls/), signing keys (app/.signing*/) and your addresses (local.env) are ignored. The released APK contains no address and no certificate.
Without root
The firewall rules and approving keys from the app need root (su for adb's shell). Without it, the rest works
the same, with less protection, and the app says so on its Settings tab:
- While adb is open, it listens on every network the phone is on, not only inside the phone, and any app on
the phone can reach it.
scripts/after-reboot.shopens it withadb tcpip 5555. What keeps others out is adb's key approval alone: only a computer whose key you approved gets in. Keep adb closed when you don't use it, and the auto-close time short. - A new computer key is approved on the phone itself: its "Allow debugging?" question (some phones, GrapheneOS
among them, show it only with a USB cable plugged in), or pairing in Wireless debugging at home. So keep the
computer's key across restarts: run the adb container with
-v adb-relay-key:/root/.androidinstead of the--tmpfsline, and approve it once.
Install
- Obtainium: tap the button on your phone, or add
https://github.com/arikw/adb-relayin Obtainium; it installs and updates the app from the releases here. - Or download the APK from Releases.
The APK contains nothing about your setup: you enter your computer's address in the app, and confirm your computer's certificate the first time it connects.
The APK is built from this code
Each release is built and signed by the maintainer. GitHub then rebuilds the APK from the release's tag,
without the signing key, in the same pinned build environment (build-env/), checks that the released APK
is exactly that build plus a signature, and only then attests it. Check a downloaded APK:
gh attestation verify adb-relay-<version>.apk --repo arikw/adb-relay
Every check is public in the repository's Actions tab (workflow "Verify release").
Requirements
- Best: a phone where an adb shell can run
su(for example a userdebug build), for the firewall rules that guard adb, and for approving new computer keys from anywhere. The app never runs as root itself; it asks adbd. Without root it works with less protection: see Without root. - A VPN that lets the phone reach the computer (the phone only ever makes outbound connections).
- On the computer: Docker, or Podman: the commands below are written for Docker, and work the same with
podmanin place ofdocker. The scripts use Podman when it is installed, Docker otherwise.
Setup
On the computer first, then the app walks you through the phone's side.
The relay's TLS key (the computer's identity; its certificate is public, the key stays here):
mkdir -p relay/tls && cd relay/tls openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -days 7300 \ -subj /CN=adb-relay-computer -keyout relay.key -out relay.crt cat relay.crt relay.key > relay.pem && chmod 600 relay.key relay.pem openssl x509 -in relay.crt -noout -fingerprint -sha256 # you'll compare this on the phoneStart the relay (from the project root):
docker run -d --name adb-relay-socat --restart=unless-stopped \ -p 7000:7000 -p 127.0.0.1:5557:5557 \ -v "$PWD/relay:/relay:ro,Z" --entrypoint socat docker.io/alpine/socat:latest \ -d -d -lh OPENSSL-LISTEN:7000,reuseaddr,fork,cert=/relay/tls/relay.pem,cafile=/relay/tls/phone.crt,verify=1,min-version=TLS1.3 \ EXEC:/relay/call.shIt lets in only the phone whose certificate is in
relay/tls/phone.crt.scripts/after-reboot.shputs it there the first time it runs (step 5).Start the adb server (
adb/build.shmakes the image withrun+commit):adb/build.sh docker run -d --name adb-relay-adb --network host --restart=unless-stopped \ --tmpfs /root/.android:rw,size=1m,mode=0700 localhost/adb-relay-adbYour addresses for the scripts:
cp local.env.example local.envand fill it in.Install the app (above) and follow its setup steps. In short:
- allow notifications and background use, and enter the computer's address (as the phone reaches it over the VPN) and port 7000;
- at home, turn on Wireless debugging; the first time pair the adb server with it
(
docker exec adb-relay-adb adb pair <address>:<pairing port> <code>), then runscripts/after-reboot.sh <wireless-debugging port>. The first time, it also approves the app's adb key, copies the app's certificate torelay/tls/phone.crtand restarts the relay; - trust the computer: compare the fingerprint the app shows with the one from step 1;
- the app then sees it is approved in adb (from then on it puts the firewall rules back by itself after a restart). If not, it can ask instead: with a USB cable plugged in (the phone closes its "Allow debugging?" question at once without one), compare the fingerprint the app shows.
Building the app yourself
build-env/make-image.sh # the pinned build environment, as localhost/adb-relay-builder
docker run --rm -v "$PWD:/p:Z" -w /p/app localhost/adb-relay-builder sh build.sh
app/out/adb-relay-unsigned.apk is reproducible (same commit, same bytes); app/out/adb-relay.apk is the same
signed with a local development key. Releases: scripts/release.sh <version>.
Daily use
docker exec adb-relay-adb phone my-project shell getprop ro.build.version.release
docker cp app.apk adb-relay-adb:/tmp/ && docker exec adb-relay-adb phone my-project install -r /tmp/app.apk
- A new computer key (after the adb container or the computer restarts): the app pops up
"A new computer asks for adb access". Compare its fingerprint with
docker logs adb-relay-adb | grep fingerprintand tap "Approve this computer". Works from anywhere. - After a phone reboot, adb stays closed on purpose. At home, turn on Wireless debugging and run
scripts/after-reboot.sh <wireless-debugging port>: it puts the firewall rules back, opens adb on 5555, and waits for the app to call in. - Logs:
docker logs -f adb-relay-socat(one line per phone call); the app's "Commands" tab filters by project and by commands that ran as root.
Notes
- adb's emulator scan is turned off in the adb container (
ADB_LOCAL_TRANSPORT_MAX_PORT=5554): the relay's 5557 falls in the scanned range, and a second connection would fight the real one. - One adb connection at a time goes through the relay; share the one adb server rather than starting others.
- If the computer is reached through a port forward that keeps connections open (VS Code, for example), a dead call can look alive; the relay handles it by letting each new call replace the previous one.
scripts/longrun-test.shchecks the line every few minutes (Doze state, screen, route) and logs totest-logs/(ignored by git).
Layout
app/ Android app (AndroidManifest.xml, src/, res/, build.sh)
build-env/ the pinned build environment (Containerfile, install.sh, make-image.sh)
relay/ socat relay: call.sh (TLS keys in relay/tls/, not in git)
adb/ adb server image: entrypoint.sh, the phone wrapper, build.sh
scripts/ after-reboot.sh, longrun-test.sh, release.sh
docs/ social preview image, screenshots
License
Copyright (C) 2026 Arik W. (https://wzmn.net)
Free software under the GNU General Public License v3.0 or later (LICENSE). A
commercial license is available on request: open an issue.
Details: LICENSING.md. Contributions: CONTRIBUTING.md.
More projects
See all →2026
Wrappli
Turn websites into standalone Android apps, each with its own storage, sign-ins and network route. Built right on the phone.
15 1
2025
Android Permissions Explorer
Android Permissions Explorer is a tool for displaying information about all the permissions supported by the Android OS, offering detailed listings and a user-friendly interface for exploring and filtering these permissions.
1
2026
R-Recorder
R-Recorder: Android audio recorder that can save recordings to a folder other apps can read. Fork of Audio Recorder by Dimowner. Install with Obtainium.
2026
Messages+
Messages+: a fork of Fossify Messages that keeps spam in a Spam folder instead of deleting it.
2012
Extensions Reloader
A chrome extension for reloading unpacked extensions
339 10K 41 4.4★ (143)
2011–2018
The Broken Calculator Game
Help "Calci" the calculator to solve math problems without his broken keys!
11.2K 3.8★ (65)
