Claude Code on Android

Run Claude Code on a non-rooted Android phone via Termux + proot-distro Ubuntu. No root, no VM, no emulator.

Your Laptop (SSH client)
|
Termux (Android terminal emulator)
|
proot-distro (Ubuntu ARM64)
|
Claude Code v2.1.126

Requirements

Android phone with USB debugging enabled. No root needed.

Tested On

Samsung Galaxy Z Fold3 (SM-F926B), Android 13, 12GB RAM


1 Install Termux

Install Termux from F-Droid (not the Play Store - that version is outdated and broken).

If you have ADB access, you can install it from your PC:

# Download from F-Droid
curl -sL "https://f-droid.org/repo/com.termux_118.apk" -o termux.apk

# Install via ADB
adb install termux.apk
Do NOT install Termux from Google Play Store. It is abandoned and will not work.

2 Open Termux and Update Packages

Open the Termux app on your phone. You'll see a terminal. Run:

pkg update -y && pkg upgrade -y

It will ask about config file updates during the process. Just press Enter to accept defaults each time.

3 Install proot-distro

proot-distro lets you run a full Linux distribution (Ubuntu) inside Termux without root.

pkg install proot-distro -y

4 Install Ubuntu

proot-distro install ubuntu

This downloads and extracts Ubuntu ARM64. Takes about 2-3 minutes.

5 Log into Ubuntu and Set Up

First, log in as root to install packages and create your user:

# Enter Ubuntu
proot-distro login ubuntu

# Update Ubuntu
apt update && apt upgrade -y

# Install Node.js, Python, git
apt install -y nodejs npm git curl python3 python3-pip

6 Install Claude Code

npm install -g @anthropic-ai/claude-code

# Verify
claude --version
# 2.1.126 (Claude Code)

7 Create a Non-Root User

Claude Code blocks --dangerously-skip-permissions when running as root. Create a regular user:

# Still inside Ubuntu as root
useradd -m -s /bin/bash android

# Add ~/.local/bin to PATH for the user
echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/android/.bashrc

# Exit root
exit

From now on, log into Ubuntu with:

proot-distro login ubuntu --user android

8 Authenticate Claude Code

Launch Claude Code and follow the login prompts:

claude

It will open a browser or give you a URL to authenticate with your Anthropic account.

Alternatively, if you have an existing ~/.claude/.credentials.json from another machine, you can copy it to /home/android/.claude/.credentials.json inside the Ubuntu environment.

9 Configure Claude Code (Optional)

Create a settings file for your preferences:

mkdir -p ~/.claude
cat > ~/.claude/settings.json << 'EOF'
{
  "env": {
    "DISABLE_TELEMETRY": "1",
    "DISABLE_AUTOUPDATER": "1"
  },
  "permissions": {
    "allow": [],
    "deny": []
  },
  "effortLevel": "high",
  "showThinkingSummaries": true
}
EOF

10 Set Up SSH (Access from Laptop)

This lets you SSH into the phone from your laptop and run Claude Code remotely.

On the phone (in Termux, not Ubuntu):

# Exit Ubuntu first if you're inside it
exit

# Install SSH server
pkg install openssh -y

# Set a password
passwd

# Start SSH server
sshd

# Find your phone's IP
ifconfig wlan0 | grep inet
Termux SSH runs on port 8022 (not 22). Your username is shown by running whoami (e.g., u0_a271).

On your laptop:

# Connect to the phone
ssh -p 8022 u0_a271@<PHONE_IP>

# Enter your password, then launch Ubuntu + Claude Code
proot-distro login ubuntu --user android
claude

Set up SSH key auth (no password needed):

# On your laptop - generate a key
ssh-keygen -t ed25519 -f ~/.ssh/termux_phone -N ""

# Copy it to the phone
ssh-copy-id -p 8022 -i ~/.ssh/termux_phone u0_a271@<PHONE_IP>

# Now connect without password
ssh -i ~/.ssh/termux_phone -p 8022 u0_a271@<PHONE_IP>

Quick Reference

ActionCommand
Open Ubuntuproot-distro login ubuntu --user android
Start Claude Codeclaude
Start SSH serversshd (in Termux, not Ubuntu)
Find phone IPifconfig wlan0 (in Termux)
SSH from laptopssh -p 8022 u0_a271@<IP>
SSH + Ubuntu one-linerssh -p 8022 u0_a271@<IP> -t "proot-distro login ubuntu --user android"
Stop SSH serverpkill sshd
Check Claude versionclaude --version
Update Claude Codenpm update -g @anthropic-ai/claude-code

Troubleshooting

Claude Code says "cannot be used with root/sudo"

You're logged in as root. Use proot-distro login ubuntu --user android instead.

SSH connection refused

Make sure you're using port 8022, not the default 22. Also ensure sshd is running in Termux.

"~/.local/bin is not in your PATH" warning

Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc

Phone IP changed

The WiFi IP changes when reconnecting. Check the new IP with ifconfig wlan0 in Termux, or via ADB: adb shell ip addr show wlan0

proot warning: can't sanitize binding

Harmless. This is normal proot behavior, ignore it.

dbus errors during apt upgrade

Normal in proot. dbus doesn't run in a proot container, but nothing depends on it.

Lag / slow command execution

proot uses ptrace to emulate root, which adds overhead to every system call. This is the tradeoff for not needing real root. It's usable but not as fast as native Linux.