Running Claude Code on a VPS, and what usually breaks
Short answer: putting Claude Code on a rented server works well, and four things usually go wrong. The session dies when you log out, nothing restarts after a reboot, the server sits open to the internet, or the Telegram connection fails silently. All four are quiet, so you find out the next morning.
A small server costs a few dollars a month and never sleeps, which makes it a much better home for a long running AI coding session than your laptop. Getting it there is an evening of work. Here is what that evening actually contains.
1. The session dies the moment you log out
This is the first wall almost everyone hits. You connect to the server, start Claude Code, it works beautifully, you disconnect, and it stops.
Claude Code needs a real terminal attached to it. Start it as a plain background process and it will not settle into its normal mode at all. What you want is a session that keeps existing after you leave, so you can walk away and come back to the same thing still running.
2. Nothing starts again after a reboot
Servers restart. Sometimes for updates, sometimes because the provider moved something. If your setup only exists because you typed it in by hand, a reboot wipes it out. The machine comes back up, sits there idle, and you have no idea until you check.
The fix is to make it a proper service, so the server knows to start it on boot and to start it again if it crashes.
3. The server is wide open
A brand new server usually accepts connections from anywhere, and if it allows password logins, automated attacks will start guessing within minutes of it existing. This is not paranoia, it is just what the internet does to any new address.
At minimum, turn on a firewall that blocks everything except what you need, turn off password logins entirely, and do not run everything as the root user.
4. Telegram fails without telling you
Connecting a Telegram bot looks easy and mostly is. The failure mode is what makes it annoying. Get the token slightly wrong, for example by wrapping it in quotes when it should be bare, and nothing errors out. The bot just never answers. You will assume the problem is somewhere else and look in the wrong place for an hour.
How to tell which one you hit
- You reconnect and it is gone: the session did not survive your logout.
- The server is up but idle: it rebooted and nothing restarted.
- Strange load or logins you do not recognise: it was left open.
- Your messages go nowhere: the Telegram token or the pairing.
Worth doing yourself?
If you enjoy running your own machines, yes. You will learn things and it is cheap. If you would rather spend tonight on your app, we do the whole list for you and the machine restarts itself when something breaks at 3am. There is a fuller side by side on doing it yourself versus not.