Run Claude Code on a non-rooted Android phone via Termux + proot-distro Ubuntu. No root, no VM, no emulator.
Android phone with USB debugging enabled. No root needed.
Samsung Galaxy Z Fold3 (SM-F926B), Android 13, 12GB RAM
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
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.
proot-distro lets you run a full Linux distribution (Ubuntu) inside Termux without root.
pkg install proot-distro -y
proot-distro install ubuntu
This downloads and extracts Ubuntu ARM64. Takes about 2-3 minutes.
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
npm install -g @anthropic-ai/claude-code
# Verify
claude --version
# 2.1.126 (Claude Code)
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
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.
~/.claude/.credentials.json from another machine, you can copy it to /home/android/.claude/.credentials.json inside the Ubuntu environment.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
This lets you SSH into the phone from your laptop and run Claude Code remotely.
# 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
whoami (e.g., u0_a271).# 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
# 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>
| Action | Command |
|---|---|
| Open Ubuntu | proot-distro login ubuntu --user android |
| Start Claude Code | claude |
| Start SSH server | sshd (in Termux, not Ubuntu) |
| Find phone IP | ifconfig wlan0 (in Termux) |
| SSH from laptop | ssh -p 8022 u0_a271@<IP> |
| SSH + Ubuntu one-liner | ssh -p 8022 u0_a271@<IP> -t "proot-distro login ubuntu --user android" |
| Stop SSH server | pkill sshd |
| Check Claude version | claude --version |
| Update Claude Code | npm update -g @anthropic-ai/claude-code |
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.