The idea is appealing, and it is a good one. A coding agent installed on a VPS keeps working while your computer is off. You hand it a task from your phone, it makes progress, and you review the result the next morning. For a few euros a month, you get a development workstation that never sleeps.
The tutorials doing the rounds show the installation: rent the server, run the command, sign in, drive the agent remotely. They stop when the demo works. Yet an internet-facing server hosting an agent that can execute commands combines three things an attacker looks for: a reachable machine, secrets, and a program that obeys text.
This article picks the subject up where the demo ends.
What you have actually installed
A coding agent reads files, writes files, and runs commands with the rights of the account that executes it. On a workstation, you sit in front of the screen and approve. On a server, the whole point is to stop approving every action. Human review, which was the first safeguard, disappears.
Three consequences follow.
The agent inherits everything its account can see. If it runs as root, it can do anything on the machine. If it runs under your usual account, it can read your SSH keys, your Git tokens and your environment files.
The agent reads content you did not write. A web page, a dependency, a ticket or a README file can carry hidden instructions. This is prompt injection: the text being read becomes an order. With nobody there to approve, the order is carried out.
Remote control does not move the agent. When you drive a session from your phone, the agent keeps running on your server, with its rights and its network access. The remote interface is a remote control. No isolated machine sits between the agent and your system.
The five most common omissions
1. The server itself is not hardened
A fresh VPS answers on SSH with a password, often for the root account. Bots scan it within minutes of it going online. Before installing anything:
- SSH access by key only, passwords disabled;
- direct
rootlogin forbidden; - firewall closed by default for inbound traffic, open on the one port you need;
- automatic security updates;
- a tool that bans repeated login attempts.
None of this is specific to AI. It is the foundation without which the rest is pointless.
2. The agent runs under an account with too much power
Create an account dedicated to the agent, with no administration rights and a working directory of its own. That account must hold neither your personal keys nor access to your other projects. If the agent is hijacked, the damage stops at that directory.
3. Permissions are lifted wholesale
To let an agent work alone, it is tempting to switch off every approval prompt. Claude Code offers an option for that, and its name contains the word "dangerously" for a reason. The vendor's documentation only considers it behind isolation that blocks unapproved outbound traffic.
The sound approach rests on two settings. First, permission rules: a list of what is allowed without asking and, above all, a list of prohibitions (permissions.deny) for secret files and sensitive commands. Second, the built-in sandbox, which bounds the directories the agent can reach and the hosts it can contact. The vendor stresses one point: isolation only works if it covers both files and network. An agent locked in a directory, with open internet access, can still send that directory elsewhere.
4. Secrets are within reach
A .env file at the project root, a GitHub token with full rights, an API key with no spending cap: that is the usual loot. Three rules are enough.
- Give the agent narrowly scoped tokens, limited to one repository and to the actions it needs.
- Set a spending cap on the model API key.
- Keep production secrets off the machine where the agent works.
5. Nobody watches what the agent does
An agent that works at night must leave a readable trail in the morning. Claude Code can export its usage metrics to a monitoring tool, and its hooks let you record every tool call in your own log. Add ordinary server monitoring: SSH logins, unusual processes, outbound traffic. Without logs, a hijack goes unnoticed until the invoice or the leak.
The question of extensions
An installed agent quickly attracts skills, plugins and MCP servers. Each one widens what the agent can do, and therefore what a booby-trapped text can make it do. On an unattended server the rule is simple: install only what you have read, and keep a list of what is installed. The vendor says so itself: the connectors in its directory are reviewed against listing criteria, with no security audit on its part. Our article on what a CISO should read before installing a plugin gives the method.
What you can keep from the tutorial
The installation shown in those videos is correct, and the use case is truly useful. What is missing is the order of operations:
- harden the server;
- create the dedicated account and its working directory;
- install the agent under that account;
- set permissions and sandbox before the first task;
- provide narrowly scoped secrets;
- connect logging;
- only then open remote control.
In that order, the extra hour pays for itself at the first incident avoided.
For a company, the question changes scale
A developer who sets up a personal VPS takes a risk for themselves. In an organisation, the same setup creates a development workstation outside the inventory, holding company code, access tokens and an autonomous agent, on a machine IT does not know about. It is shadow IT with execution rights.
The answer comes down to three decisions: a server template for agents approved by security, settings enforced centrally and not left to each person, and a register of approved extensions. Our enterprise deployment guide details the settings.
nAIvigate Studio carries out this hardening as a short engagement: configuration review, managed settings, extension register and incident response procedure. Tell us about your context.