How to Run Claude Code on a VPS with Telegram Mobile Access Anthropic's Claude Code CLI tool can be run 24/7 on a virtual private server and controlled remotely from a mobile phone via Telegram. The setup requires provisioning an Ubuntu VPS, installing Node.js and the Claude Code package, configuring SSH key authentication and a firewall, and wiring in a Telegram bot using the Channels plugin for persistent terminal access through Tmux. This configuration offloads compute from a local machine and enables developers to check on long-running tasks, send instructions, or review output from anywhere without keeping a laptop open. How to Run Claude Code on a VPS with Telegram Mobile Access Run Claude Code 24/7 on a VPS and control it from your phone via Telegram. Step-by-step SSH, Tmux, and Channels plugin setup guide. Why Running Claude Code on a VPS Makes Sense Running Claude Code on a remote server changes how you work with it. Instead of keeping your laptop open, tethered to a project directory, you offload the compute to a VPS that runs around the clock. Add a Telegram bot on top and you can check in on long-running tasks, send new instructions, or review output from your phone — anywhere. This guide walks through the complete setup: spinning up a VPS, installing Claude Code, creating persistent terminal sessions with Tmux, and wiring in a Telegram bot using the Channels plugin so you have full mobile access. If you’ve been looking for a way to run Claude Code 24/7 without babysitting your terminal, this is the setup. What You’ll Need Before Starting This is a technical setup. You don’t need to be a systems administrator, but you should be comfortable with the command line. Prerequisites: - A VPS from any provider DigitalOcean, Hetzner, Linode, or Vultr all work — a $6/month instance is enough for most Claude Code workloads - A local machine with an SSH client - An Anthropic API key with Claude access - A Telegram account - Node.js familiarity for installation and basic troubleshooting If you’re using this setup for serious development work, pick a VPS with at least 2GB RAM. Claude Code’s context management can get memory-hungry on large codebases. Set Up and Secure Your VPS Choose and Provision Your Server Spin up an Ubuntu 22.04 or 24.04 LTS instance — it’s the most compatible with the packages you’ll need. A 2-core, 2GB RAM instance is a reasonable starting point. Once provisioned, you’ll get an IP address and root credentials. Don’t stay as root longer than you need to. Create a Non-Root User and Configure SSH SSH in as root first: ssh root@your-server-ip Create a new user with sudo privileges: adduser youruser usermod -aG sudo youruser Switch to that user and set up SSH key authentication: su - youruser mkdir ~/.ssh chmod 700 ~/.ssh On your local machine , generate an SSH key pair if you don’t have one: ssh-keygen -t ed25519 -C "your-email@example.com" Copy your public key to the server: ssh-copy-id youruser@your-server-ip Once key authentication is confirmed working, disable password login on the server by editing /etc/ssh/sshd config : sudo nano /etc/ssh/sshd config Set these lines: PasswordAuthentication no PermitRootLogin no Then restart SSH: sudo systemctl restart sshd This closes off a major attack surface. Your server won’t accept brute-force password attempts anymore. Set Up a Basic Firewall sudo ufw allow OpenSSH sudo ufw enable You can open additional ports later if your Claude Code setup needs to serve web requests. Install Claude Code on Your Server Install Node.js Claude Code requires Node.js 18 or higher. The cleanest way to install it on Ubuntu is through NodeSource: curl -fsSL https://deb.nodesource.com/setup 20.x | sudo -E bash - sudo apt-get install -y nodejs Verify the install: node --version npm --version Install Claude Code CLI Claude Code is Anthropic’s official CLI coding agent. Install it globally: npm install -g @anthropic-ai/claude-code Set Your API Key Claude Code reads your Anthropic API key from an environment variable. Add it to your shell profile so it persists across sessions: echo 'export ANTHROPIC API KEY="your-api-key-here"' ~/.bashrc source ~/.bashrc Replace your-api-key-here with your actual key from the Anthropic Console https://console.anthropic.com . Test the Installation Create a test directory and run Claude Code: mkdir ~/test-project && cd ~/test-project claude If you see the Claude Code prompt, the installation worked. Exit with /exit and move on. Set Up Tmux for Persistent Sessions This is the most important part of the setup. Without Tmux or a similar terminal multiplexer , your Claude Code session dies the moment your SSH connection drops. With it, you can disconnect, close your laptop, and come back hours later to find everything exactly where you left it. Install Tmux sudo apt install tmux -y Essential Tmux Concepts Tmux works around three things: Sessions — top-level containers that survive SSH disconnects Windows — tabs within a session Panes — split views within a window For Claude Code, you typically want one named session per project. Start a Named Session tmux new-session -s claude-project This creates a session called claude-project . You can detach from it at any time with Ctrl+B, D — the session keeps running on the server. Reattach to a Session When you SSH back in: tmux attach -t claude-project Or list all running sessions: tmux ls Useful Tmux Shortcuts | Action | Shortcut | |---|---| | Detach session | Ctrl+B, D | | List sessions | Ctrl+B, S | | New window | Ctrl+B, C | | Switch window | Ctrl+B, 0-9 | | Split pane horizontally | Ctrl+B, % | | Split pane vertically | Ctrl+B, " | | Scroll mode | Ctrl+B, | Remy doesn't write the code. It manages the agents who do. Remy runs the project. The specialists do the work. You work with the PM, not the implementers. A good practice: create one window for Claude Code, one for watching logs, and one for running tests. You can switch between them instantly without disconnecting. Run Claude Code Inside Tmux cd ~/your-project claude Detach and your session keeps running. Come back from any device with SSH access and you’ll pick up exactly where you left off. Create Your Telegram Bot Telegram gives you a free, reliable messaging layer that works on every phone. You’ll use it as a command interface for your Claude Code session. Create a Bot with BotFather - Open Telegram and search for @BotFather - Start a conversation and send /newbot - Follow the prompts — give your bot a name and a username must end in bot - BotFather will give you a bot token that looks like 123456789:ABCdefGhIjKlmNoPqrStUvWxYz Save this token. You’ll need it shortly. Get Your Chat ID You need your personal Telegram chat ID so the bot only responds to you not anyone who finds it . Start a conversation with your new bot by searching for it in Telegram, then send it any message. Now fetch your chat ID by visiting this URL in a browser: https://api.telegram.org/bot