Turn Your Android Phone into a Tor Relay Using Termux (No Root)

18 min read Step‑by‑step guide to configure a Tor relay on an Android device with Termux, without rooting. Includes setup, configuration, bandwidth tips and troubleshooting. October 14, 2026 10:00 How to Turn Your Android Phone into a Tor Relay Using Termux (No Root)

Running a Tor relay helps keep the Tor network healthy and improves anonymity for millions of users. If you have an Android device that is often on Wi‑Fi and plugged in, you can contribute without rooting or flashing custom firmware. This tutorial walks you through every step – from installing Termux to configuring Tor, verifying that your relay is reachable, and handling the most common hiccups.

Before You Start

  • Device requirements: Android 8.0 (Oreo) or newer. Older versions may lack the required OpenSSL libraries.
  • Network requirements: Unrestricted outbound TCP on port 9001 (default relay port) and inbound TCP on the same port. Many home routers block inbound connections by default; you will need to forward the port.
  • Bandwidth considerations: Tor relays consume both upload and download bandwidth. A minimum of 1 Mbps upload is recommended for a stable middle relay. Check your ISP’s data caps.
  • Power: Keep the phone plugged into a charger. Running Tor continuously can drain the battery quickly.
  • Permissions: Termux needs storage permission to write its configuration files. Grant it when prompted.
Note: This guide does not require root. All operations stay within the user space provided by Termux.

Step 1 – Install Termux and Update Packages

  1. Open the Google Play Store (or F-Droid for a privacy‑focused version) and install Termux.
  2. Launch Termux. The first launch may ask for storage permission. Accept it by tapping Allow.
  3. Update the package repository and upgrade existing packages:
    pkg update && pkg upgrade -y
    This ensures you have the latest versions of libc, openssl, and other dependencies.
  4. Install the essential tools:
    pkg install wget curl tar proot -y
    Why? wget and curl will fetch the Tor binaries; proot lets us run a Linux‑like environment without root.

Step 2 – Install Tor Inside Termux

  1. Termux provides a tor package in its community repository. Enable the x11-repo and root-repo (they contain the package):
    pkg install x11-repo root-repo -y
  2. Now install Tor:
    pkg install tor -y
    This places the tor executable at ~/../usr/bin/tor.
  3. Verify the installation:
    tor --version
    You should see something like Tor version 0.4.7.13. If the command fails, re‑run the install step.

Step 3 – Create a Dedicated Tor Configuration for a Relay

Tor’s default configuration runs as a client. To become a relay we need a custom torrc file.

  1. Create a directory to hold Tor’s data and config:
    mkdir -p $HOME/tor/relay
  2. Open a text editor (Termux ships with nano) and create torrc:
    nano $HOME/tor/relay/torrc
  3. Paste the following configuration (replace placeholders where indicated):
    # Basic relay settings
    ORPort 9001
    Nickname MyAndroidRelay
    ContactYourName <your.email@example.com>
    # Bandwidth limits – adjust to your plan
    RelayBandwidthRate 100 KBytes
    RelayBandwidthBurst 200 KBytes
    # Directory authority contacts (default list is fine)
    # Optional: run as a non‑exit relay (recommended for most users)
    ExitPolicy reject *:*
    # Data directory
    DataDirectory $HOME/tor/relay/data
    # Log to file for troubleshooting
    Log notice file $HOME/tor/relay/tor.log
    
    Explanation:
    • ORPort 9001 – the port other Tor nodes will use to connect to you.
    • Nickname – a human‑readable identifier that appears in the network consensus.
    • ContactInfo – optional but helpful if the Tor project needs to reach you.
    • RelayBandwidthRate/Burst – caps to avoid exceeding ISP limits.
    • ExitPolicy reject *:* – makes this a non‑exit relay, which is safer for most home connections.
    • DataDirectory – where Tor stores its keys and cached descriptors.
  4. Save the file (Ctrl+O in nano) and exit (Ctrl+X).

Step 4 – Open the Required Port on Your Router

Tor needs inbound connections on the ORPort you chose (default 9001). The steps differ by router brand, but the general process is:

  1. Log into your router’s web interface (usually 192.168.1.1 or 192.168.0.1).
  2. Locate the Port Forwarding or Virtual Server section.
  3. Create a new rule:
    • External Port: 9001
    • Internal IP: the IP address of your Android device (check in Settings > About phone > Status).
    • Internal Port: 9001
    • Protocol: TCP
  4. Save the rule and reboot the router if required.
Warning: Exposing a port to the internet can increase your attack surface. Keep your Android OS and Termux packages up to date, and consider using a strong, unique nickname and contact email.

Step 5 – Start Tor as a Background Service

Running Tor continuously is easier if we launch it as a background process that restarts after reboots.

  1. First, test a manual start to ensure the configuration works:
    tor -f $HOME/tor/relay/torrc
    You should see log lines ending with Bootstrapped 100%: Done. Leave this terminal open for a few minutes to verify that no errors appear.
  2. Stop the manual instance by pressing Ctrl+C.
  3. Create a simple startup script:
    cat > $HOME/tor/relay/start_tor.sh <<'EOF'
    #!/data/data/com.termux/files/usr/bin/bash
    # Ensure the data directory exists
    mkdir -p $HOME/tor/relay/data
    # Start tor in the background, redirecting stdout/stderr to the log file
    nohup tor -f $HOME/tor/relay/torrc > $HOME/tor/relay/tor.log 2>&1 &
    EOF
    chmod +x $HOME/tor/relay/start_tor.sh
    
  4. Run the script to launch Tor:
    $HOME/tor/relay/start_tor.sh
    The nohup command detaches Tor from the terminal, allowing you to close the Termux session without stopping the relay.
  5. Verify that Tor is running:
    ps -A | grep tor
    You should see a line with tor and its PID.

Step 6 – Make the Relay Start on Device Boot

Termux can execute scripts automatically when the device boots using the termux-wake-lock and termux-boot add‑ons.

  1. Install the termux-boot package from F-Droid (the Play Store version may not include the boot helper):
    pkg install termux-boot -y
  2. Create the boot script directory if it does not exist:
    mkdir -p $HOME/.termux/boot
  3. Copy the start script into the boot directory and rename it to boot.sh:
    cp $HOME/tor/relay/start_tor.sh $HOME/.termux/boot/boot.sh
    chmod +x $HOME/.termux/boot/boot.sh
  4. Optionally, add a wake‑lock to keep the CPU awake while Tor is running:
    termux-wake-lock
    Place this command at the top of boot.sh if you want the lock to be acquired automatically.
  5. Reboot the phone and, after a minute, open Termux and check the log:
    cat $HOME/tor/relay/tor.log | tail -n 20
    Look for the same Bootstrapped 100% line.

Step 7 – Verify That Your Relay Is Visible to the Tor Network

The Tor Project provides a public relay lookup tool. You can check your relay’s status without leaving the phone.

  1. Find your public IP address (the one visible to the internet). In Termux run:
    curl https://ifconfig.me
  2. Open a web browser on any device and go to Tor Relay Search. Search for the nickname you set (e.g., MyAndroidRelay) or for your IP.
  3. If the relay appears with a green “Running” flag, you’re done! It may take a few minutes for the network consensus to update.

Step 8 – Monitor Your Relay and Adjust Bandwidth

Running a relay is a long‑term commitment. You’ll want to keep an eye on bandwidth usage and log size.

  • View the live log:
    tail -f $HOME/tor/relay/tor.log
  • Check bandwidth statistics with the built‑in Tor control port (optional). Enable it in torrc:
    ControlPort 9051
    CookieAuthentication 1
    Then use telnet localhost 9051 or a GUI client like Nyx (installable via pip install nyx inside Termux).
  • If you notice you’re approaching your ISP’s cap, lower the RelayBandwidthRate and RelayBandwidthBurst values, then restart Tor:
    pkill tor
    $HOME/tor/relay/start_tor.sh

Troubleshooting Common Issues

1. Tor fails to start – “Port already in use”

This usually means another app (or a previous Tor instance) is already bound to port 9001.

  • Check which process uses the port:
    netstat -tuln | grep 9001
  • If you see a tor entry, kill it:
    pkill tor
  • Alternatively, change ORPort in torrc to an unused port (e.g., 9002) and update the router’s port‑forward rule accordingly.

2. Relay does not appear in the Tor network after 30 minutes

  • Confirm that your public IP is not listed in Tor’s exit‑address blacklist. Some ISPs block Tor traffic.
  • Verify that the inbound port is truly reachable. From another device (or a remote server) run:
    nc -vz YOUR_PUBLIC_IP 9001
    It should report open. If it times out, double‑check your router’s port forwarding and any ISP‑level NAT.
  • Check the log for messages like Connection refused or Network unreachable. Those indicate routing problems.

3. High data usage or ISP throttling

  • Reduce the bandwidth caps in torrc. A safe baseline for most home connections is RelayBandwidthRate 50 KBytes and RelayBandwidthBurst 100 KBytes.
  • Consider running a bridge instead of a full relay. Bridges use less bandwidth and are less likely to be blocked. To switch, replace the ORPort line with:
    BridgeRelay 1
    ORPort 443
    
    and forward port 443.

4. “Permission denied” when writing to the data directory

Termux runs in a sandboxed environment. If you moved the tor directory to external storage (e.g., /sdcard/tor), Android may block write access.

  • Keep the data directory inside Termux’s home ($HOME) as shown.
  • If you must use external storage, grant Termux the MANAGE_EXTERNAL_STORAGE permission via Android Settings > Apps > Termux > Permissions.

Advanced Optional Tweaks

  • Run Tor as a systemd‑like service. Termux now supports termux-services. Install it and create a service file for Tor to get better start/stop handling.
  • Use a VPN. If your ISP blocks Tor, you can run a VPN client inside Termux (e.g., openvpn) and route Tor traffic through it. This adds latency but may be the only way to stay online.
  • Log rotation. Prevent the log file from growing indefinitely:
    logrotate -f $HOME/tor/relay/tor.log
    (Install logrotate via pkg install logrotate.)

Safety and Legal Considerations

Running a Tor relay is legal in most jurisdictions, but some countries treat Tor traffic suspiciously. Before enabling a relay:

  • Check local laws regarding anonymizing services.
  • Read the Tor Project’s FAQ on running relays for policy guidance.
  • Never configure an exit relay on a residential connection unless you fully understand the liability implications. The configuration above deliberately rejects all exit traffic.

Wrapping Up

By following the steps above you have turned an ordinary Android phone into a contributing Tor relay, all without rooting or flashing. The device now helps keep the Tor network robust, and you gain a deeper understanding of networking, Linux‑style services, and privacy‑preserving infrastructure.

Remember to monitor bandwidth, keep the software up to date (pkg upgrade -y), and adjust the torrc settings as your network situation evolves. Your contribution, even from a modest home Wi‑Fi connection, makes a measurable difference for users worldwide.

User Comments (0)

Add Comment
We'll never share your email with anyone else.