How to Run Claude Code Anywhere on a VPS

TL;DR
Run Claude Code on a virtual private server so workflows, files, scheduled jobs, and shared context remain available even when your laptop is closed. Generate an ED25519 SSH key pair, add the public key to a managed or self-administered Ubuntu server, then connect remotely through VS Code, a phone, or Telegram while keeping the private key secret.
Transcript
Most people run claw code on their main machine, but if it goes to sleep or you close the lid, then everything stops and it's one of the main reasons why open claw and Hermes are so popular. So, in this video, I'll show you how to run claw code permanently on a VPS with a super simple setup. We'll go step by step, and by the end, you'll have 24/7 w... Read More
Key Insights
- A VPS is an always-on rented computer that keeps Claude Code workflows running after a laptop sleeps or its lid closes. It stores the working file structure remotely and can be reached from VS Code or a phone, removing dependence on the user’s primary machine.
- A persistent server is different from an isolated managed-agent session because its folders, context, skills, and scheduled routines continue evolving over time. Managed web agents can complete individual repository tasks, but each separate session resets rather than serving as a permanent operating environment.
- A shared VPS gives a team access to the same file structure and working environment. Scheduled jobs and workflows continue in the background whether individual laptops are open or shut, and the server can update GitHub in the same way as a local computer.
- The VPS setup is tool and provider agnostic because the underlying asset is a persistent file structure on a controlled server. Claude Code can be replaced with Codex later without discarding the entire infrastructure, making the environment portable across agent tools.
- SSH is a secure method for operating one computer from another over the internet. A laptop or phone acts as the client, commands run on the VPS host, and the resulting output returns to the device, effectively providing remote access to the server’s keyboard.
- An ED25519 SSH key pair contains a private key that must remain secret and a public key that is safe to share. During connection, the server verifies that the client device holds the corresponding private key instead of relying only on a password.
- A managed VPS reduces administrative work by handling functions such as backups, monitoring, and server maintenance. A do-it-yourself Hetzner path costs less and offers more control, but the user remains responsible for administration, patches, and backups.
- The Remote - SSH extension from Microsoft lets Visual Studio Code open a folder on the remote machine while retaining the editor’s feature set. After the VPS is deployed and its SSH key is configured, the extension provides a desktop route into the always-on environment.
Install to Summarize YouTube Videos and Get Transcripts
Explore YouTube Video Summarizer or Get YouTube Transcript Extractor
Questions & Answers
Q: Why run Claude Code on a VPS instead of a laptop?
Running Claude Code on a VPS keeps the agent environment available when a laptop sleeps, shuts down, or has its lid closed. The rented computer remains online and preserves the file structure, brand context, skills, workflows, and scheduled jobs. It can also be accessed remotely from VS Code or a phone, and multiple team members can connect to the same working environment.
Q: How is a Claude Code VPS different from Claude.ai chat?
Claude.ai chat is suited to thinking, one-off tasks, and conversations, but it does not provide the same persistent backend file structure or context-injection management described for Claude Code on a VPS. A server can retain evolving files, brand context, skills, cron jobs, and scheduled routines while also taking actions through an environment that the user directly controls.
Q: How does a VPS differ from managed Claude agents on the web?
Managed agents or Claude Code on the web can receive a task connected to a GitHub repository and run it in a separate session that can be watched from a phone. That session is isolated and resets each time. A user-controlled VPS instead maintains a persistent folder structure that evolves across tasks and supports continuing workflows, context, and scheduled routines.
Q: What is SSH and how does it provide remote server access?
SSH stands for secure shell and provides a safe way to operate one computer from another over the internet. The laptop or phone is the client, while the VPS is the host. A command typed on the client runs on the server, and the output returns to the client, which is similar to sitting at the remote server’s keyboard.
Q: How do you create an SSH key for a Claude Code VPS?
Open Terminal on a Mac or PowerShell on Windows, then run the demonstrated SSH key-generation command with your own email. The process creates an ED25519 public and private key pair. Accept the default file location, optionally set a passphrase, and print the public key so it can be copied into the VPS provider during server configuration.
Q: Which SSH key can be shared with the VPS provider?
The public SSH key can be copied into the VPS provider because it is designed to be shared. The private key must remain secret and stay on the local device. When a connection is attempted, the server checks that the device holds the corresponding private key, providing an encrypted connection without placing the private credential on the provider’s system.
Q: Should you choose a managed or do-it-yourself VPS?
Choose the do-it-yourself path if lower cost, greater control, and direct server administration are priorities. That option requires responsibility for patches, backups, and other maintenance. Choose the demonstrated managed path if you want the provider to provision the server, perform backups, monitor its condition, and reduce the amount of direct server administration required.
Q: How do you connect Visual Studio Code to the remote VPS?
Install Microsoft’s Remote - SSH extension from the extensions area in Visual Studio Code. The extension is designed to open folders on a remote machine through SSH while providing the editor’s full feature set. After the VPS has been deployed and configured with the public SSH key, its connection details and key configuration can be used to access the remote environment.
Summary & Key Takeaways
-
A VPS turns Claude Code into an always-on system that does not depend on a laptop remaining awake. Its persistent file structure can hold brand context, skills, scheduled routines, and shared project files, while remote access allows individuals or teams to work with the same environment from computers or phones.
-
SSH provides the secure connection between a local device and the remote server. The setup creates an ED25519 public and private key pair, keeps the private key on the local computer, and gives the public key to the server provider. Commands entered locally then execute on the rented server.
-
The server can be created through a lower-cost do-it-yourself provider or through a managed service that handles backups and monitoring. After deployment, the Remote - SSH extension in Visual Studio Code connects the development environment to the VPS, while mobile and Telegram options extend access beyond the laptop.
Read in Other Languages (beta)
Share This Summary 📚
Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator
Explore More Summaries from Simon Scrapes 📚






Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator