The Deska blog
Running Claude Code on a VPS: Setup and Access Patterns
Learn the technical steps for running Claude Code on a VPS, covering SSH configurations, agentic workflows, and secure remote access patterns for developers.
· 11 min read
Deploying and running Claude Code on a VPS offers developers a centralized, high performance environment for agentic development that remains independent of local hardware constraints. By moving the agent process to a Virtual Private Server, you ensure that long running tasks, complex refactors, and test suites can continue executing even if your local machine goes offline. This guide explores the architectural considerations, security implications, and specific setup patterns required to maintain a seamless connection between your local interface and a remote Claude Code instance.
The Case for a Cloud Box Agent Setup
Traditional local development involves running CLI tools directly on your laptop. However, when using agentic tools like Claude Code, the resource demands can fluctuate significantly during intense file indexing or large scale codebase analysis. A VPS provides a stable IP, consistent build environments, and the ability to leverage faster network speeds for downloading dependencies or deploying artifacts.
Using a cloud box agent setup also facilitates better collaboration. Since the session lives on a server, you can attach and detach from the process without losing the conversational context or the current state of the filesystem. This is particularly useful for teams working on legacy systems where the environment setup is brittle and difficult to replicate across different machines.
Preparing the Remote Environment
Before you begin the installation, you must ensure your VPS meets the basic requirements for modern coding agents. Claude Code and similar CLI tools generally require a recent version of Node.js along with specific system utilities like git and curl to interact with your repositories.
- Provision a VPS with at least 4GB of RAM. While smaller instances might function, agents often perform heavy operations that can trigger OOM (Out of Memory) kills on 1GB or 2GB machines.
- Install a process manager like
tmuxorscreen. This is critical because it allows the agent to survive an SSH disconnection. - Configure your API keys. Since Claude Code requires authentication with Anthropic, you should store your keys in a secure environment variable or a protected file within your home directory.
Once the environment is prepared, you can install the agent via your preferred package manager. It is generally recommended to use a global installation to ensure the binary is available across different directory contexts within the server.
Security and Connectivity Patterns
Running a coding agent on a remote server introduces specific security risks. The agent has the authority to read, write, and delete files based on its instructions. Therefore, you must limit its scope using standard Linux permissions.
SSH Tunneling and Persistence
The most common method for accessing a VPS is via SSH. To maintain a persistent session for Claude Code, you should start a tmux session immediately after logging in.
tmux new -s claude-session
claude-code
If your terminal closes, you can simply reconnect and run tmux attach -t claude-session to resume exactly where the agent left off. This pattern is foundational for any remote local-first workflow where the execution happens elsewhere but the control remains in your hands.
Direct Access via Desktop Clients
Managing multiple SSH sessions manually can become cumbersome as your project grows. Some tools, like Deska, allow you to integrate these remote sessions into a structured workspace. Deska is a free desktop app for Mac, Windows, and Linux that provides an infinite canvas workspace where you can place terminal panels.
In Deska, you can open multiple terminals side by side. One panel might host a local terminal for git operations, while another maintains a persistent SSH connection to your VPS running Claude Code. This canvas approach allows you to zoom out and see the status of your remote agent alongside your local documentation or code.
Integrating AI Agents into Your Workflow
When you have Claude Code running on your VPS, you can pair it with other tools to create a comprehensive development suite. Many developers prefer to run coding agents like Codex CLI or OpenCode in parallel to compare suggestions or handle different parts of a microservices architecture.
Simultaneous Agent Execution
A significant advantage of using a dedicated workspace is the ability to run these agents as independent panels. For example, you can have:
- Claude Code investigating a performance bottleneck on the VPS.
- A local terminal running test suites to verify changes.
- A specialized browser panel for checking documentation.
Deska supports this by allowing you to place terminal panels anywhere on the canvas. Because it is a local-first application, your files and session metadata stay on your machine, even when the agent is communicating with a remote server.
Voice and Chat Integration
Modern developer tools are increasingly incorporating multimodal inputs. Deska includes Ask Deska, a voice and chat assistant that can drive the workspace. For instance, you could use voice commands to open new terminals or check on the status of a remote session without manually typing SSH commands every time. This reduces the cognitive load of managing a remote cloud box agent setup.
Handling Mobile Access and Monitoring
One of the largest challenges with a VPS setup is monitoring long running tasks when you are away from your desk. Traditional methods require setting up complex VPNs or exposing ports, which increases the attack surface of your server.
Deska offers a mobile app that solves this through a secure relay. It allows you to monitor and continue work from your phone by pairing devices directly. Because no ports are exposed, you maintain a high level of security while staying connected to the Claude Code session running on your VPS. This is particularly useful for checking if a remote build completed or if the agent requires further clarification on a task.
FAQ
How to use Claude Code via SSH on a remote server?
To use Claude Code via SSH, connect to your VPS using a terminal, then start a session manager like tmux to ensure the process continues if you disconnect. Install the agent using npm or your preferred manager, export your API keys, and run the binary within that persistent session.
Best practices for agentic cloud box agent setup?
Best practices include using a non-root user with restricted permissions for the agent, implementing SSH keys instead of passwords, and using a multi-panel workspace to monitor the agent's output alongside your code and logs to prevent runaway processes.
Can I run multiple AI coding agents side by side?
Yes, you can run multiple agents side by side by opening multiple terminal instances. Tools like Deska facilitate this by providing a workspace where different agent panels can be organized on an infinite canvas, allowing for real-time comparison of their outputs.
Getting Started with Advanced Workspaces
Transitioning your development to a VPS with Claude Code is a significant step toward a more robust architecture. By decoupling your execution environment from your physical hardware, you gain flexibility and power. For those looking to manage these remote connections within a unified, visual interface, you can explore the features available in Deska.
The workspace itself is free to use, and you can bring your own API keys for the lifetime tier. You can download the application for your preferred operating system and start building your custom environment today. Whether you are using terminals to talk to a remote VPS or organizing your local notes, having a centralized canvas simplifies the complexity of modern agentic development.