← Back
Milan Jovanovic November 24, 2026 17m

Stop Running Claude Code on Your Laptop

Read full transcript 13 segments
  1. Where are you currently running Cloud Code or any other agent for that matter? Is it on the same machine where you also place your confidential credentials, SSH keys, and any other thing that you probably do not want to share with your agent? Or are you running your agents inside of secure sandboxes on isolated VPSs? In this video, I want to show you how you can set up the sandbox approach. This is the setup I want to build in this video. We have three high-level components. Our client machine, this can be your development PC, a laptop, or even your mobile phone. You just need to be able to run Cloud Code, and we're going to leverage the remote control feature to connect to our Cloud Code session running on a secure VPS. We're going to use servers as proxy between the two, and then this is the actual thing we are going to build. We're going to take a VPS, which is short for virtual private server, and we're going to set up a couple of things there.

  2. First, a dev container, which is going to be our secure sandbox for developing applications using agents, in this case Cloud Code. We're going to use it to spin up a Cloud Code session inside of a dev container. We're going to add a firewall around it so that Cloud can only access the things that we allow it to. These are going to be so that the agent can actually do the work, and we can also share access to our GitHub repo so that we can work with source control, possibly NuGet, so that we can download .NET packages, and I think you get the gist of it. We're also going to use tmux for running the actual session so that it stays alive even when we aren't SSHed into the server. And this is where the sponsor of today's video comes in, Hostinger. Hostinger is where I'm running my VPSs, and I will also be using a Hostinger VPS for creating a sandbox for running Cloud Code. Right now, they have a Black Friday sale going and you're going to find some amazing deals. What I will be using is a KVM two instance, but depending on your load, there are multiple server sizes to choose from.

  3. For my use cases, a two CPU cores and eight gigabyte RAM machine is going to be plenty for running cloud code. To minimize latency, we're going to choose a data center that is as close to us as possible, and they have many data centers to choose from. So go ahead and pick whatever is closest to you. I'm going to click choose plan on the KVM two instance. Once I've chosen my VPS, I want to show you a couple of other things you can do here. First is choosing the location of your server. I'm going to use the location with the best latency, and after that, I can also reinstall some applications on the VPS which I want to use. In this case, we can install cloud code. Now, this isn't the approach I'm going to take. Instead, I want to install cloud code in our sandbox container and not directly on the VPS. So I'm going to choose Plain OS and just pick the latest LTS version of Ubuntu. And once you're happy with everything, you can go ahead and use the coupon code Milan for an additional 10% discount on top of the already existing Black Friday discount. So I'll complete this order and set up my VPS, and it may take a couple of minutes for your VPS to be set up, but after that, you'll be able to connect to it using SSH. And it may take a couple of minutes for your VPS to be set up, but after that, you'll be able to connect to it using SSH. I'm going to jump into my terminal and connect to my VPS instance

  4. and start setting up the sandbox. I set up an alias called cloud agent, which is going to point to the IP address of my VPS, and I can SSH into it and connect as an agent user. So I'm respecting one of the security best practices, which is not using the root user for managing my VPS. I'll run a couple of commands just to show you that we have a baseline VPS here. We don't currently have Docker installed or node or Cloud Code for that matter, and I'm going to elevate my session to a root user where I'll also have to enter the password and I'm doing this just so that I can install the required packages that I need. I'll run a couple of install commands and what this is going to do is it will set up Docker. So I'm going to run this. It'll take a couple of moments to complete and then we're going to proceed to our next step. The next thing we need to do is to add my agent user to the Docker group and I will also install the latest version of node as well as the Dev Container CLI. Now Dev Containers is a really interesting standard which I can spend a separate video talking about on its own, but to give you a brief explanation, it's a way to use containers for running your development environments. It's great because it allows you to share the same development environments between all of your developers and we can also use them to run containers. So here's an overview of how a Dev Container compares to a production container where you actually package up and run your application. A

  5. development container is used for development. You're also going to store source control there and in our case we're going to run agents. This gives us blast control and a couple of other things that I'll discuss as we go along. Now that I have everything installed here, I'm going to disconnect from my two sessions and just reconnect back to have everything apply and I'll rerun these commands and now you'll see that our commands do return something. We have Docker installed, node, and the Dev Container CLI. So what do we need to run our Dev Container? The way we configure everything is through a single JSON file called Dev Container . JSON and it contains the properties that are defined by the specification which allow us to set up our Dev Container and then have those settings apply across as many containers as we want to run. So we're going to give our container a name. We're also going to specify the build context and we're going to use a predefined Docker file so that we control what gets built and added to the container instance that we run. These commands here are going to control some network settings which allows us to enforce our firewall where we control what our dev container is allowed to reach or not allowed to reach. Here we specify the name of the Linux user that's going to be used from within the container itself and we're also going to mount some volumes which are going to point to our dev container settings as well as our Cloud Code settings which is where we will store our sessions, any other supporting data, and our

  6. credentials so that if we restart the container we are still connected to Cloud Code and we don't have to perform the login every time. Then let me show you the Docker file. I based it on the .NET 11 SDK as I want to use this for building .NET applications and the rest of the commands here are pretty involved but I'm going to highlight a few things. First we are installing Git which is going to allow us to work with our repositories. Then we're going to set up the user that Cloud is going to use. We're going to run the firewall initialization script and finally we're going to install Cloud Code within our Docker container and this is important to highlight because this means that Cloud Code will not be available on the VPS itself. Instead it's only going to run inside of the dev container which represents our sandbox and this gives us a lot of control and leverage in terms of what we can do to beef up our security and honestly anyone running Cloud Code or any other agent on commercial applications should really be using this approach. Running agents rampant on developer machines is only asking for trouble. I know you've seen many of the horror stories out there of agents accidentally deleting production databases or wiping your entire file system by accident. So this is going to allow you to prevent this and only give Cloud Code access to what it needs to do the work that it needs to do. The firewall script itself is pretty involved. I'm not really going to go through it. Instead here's a visual representation of what we're supposed to

  7. achieve with the firewall. We want to allow our dev container to access some specific hosts such as tropic IPs, GitHub, or NuGet. We also want to prevent it from accessing any other things. And by the same logic, if you need to expose additional APIs that your container should be able to reach, you can do so by updating your firewall settings. So back to our VPS, where I'm going to create a folder which I will call Cloud VPS, and this is where I'm going to store my actual project. And we're also going to initialize an empty git repo there. So let me run this. And now back inside of VS Code, I'm going to run a command in the terminal here to copy the contents of the .devcontainer folder to my VPS. So this is going to copy my dev container settings, which is this JSON document here, the Docker file, and the firewall init script. So once this completes, these files are on my VPS and I can use them to spin up my dev container. So here I'm going to run a couple of commands. I'm going to list what we have in the .devcontainer folder. I'm going to add them to the repo and commit these files. And I'm going to run dev container up in this location, which is going to build my Docker file into an image that we can run as a container. So let's run these commands. We're going to see the first few complete pretty quickly. Then we're going to take a couple of moments to watch this step complete as this is what's actually building our Docker image. It may take a couple of moments,

  8. so let's give it some time. And after everything completes, the image is built and we can use it to run our container. And we're also going to run our setup script after everything is set. And this is going to set up our firewall. So you can see that we allow requests to tropic, to Cloud, to NuGet. And we can also add GitHub here, but we block any other random addresses that our agent may try to reach. Let me clear the screen. And now I want to show you that if I try to run Cloud on the VPS itself, you'll see that it's not installed on the host. Instead, it's only available inside of the container. And we can prove this by running dev container exec in this folder and then passing it the cloud command. So this is going to start up cloud with the latest version at the time of recording this video, and we can configure how we want our terminal to look. So let's say I want to match whatever my terminal already looks. This is dark mode. Then I'm going to say how I will be using cloud code. And because I want to use my existing subscription, I'll choose cloud account with subscription. And this is going to give me a URL that I can access to authenticate with cloud code. So I'm going to click this URL and I'll open it locally in my browser where I can authenticate with cloud code and then authorize access for my VPS. So I'm going to click authorize and this is going to give me a code that I'm going to copy and then paste inside of my SSH session in the terminal. So if I drop it in here and click enter, that's going to

  9. complete the sign in and we're running cloud code on a VPS inside of a secure sandbox. So I'm going to press enter and then we have to acknowledge that cloud code can make mistakes. I'll say yes. I also trust this folder and finally we are inside of cloud code. Let me ask it something random like what day is it today? And you'll see that cloud code is going to actually do some work and it's going to tell me that today is Sunday, November 22nd, 2026. So I'm happy with this and we can type exit and exit the CLI. And this is because the way I started cloud code isn't going to survive a disconnection from this SSH session. Instead, I'm going to run it using tmux. So let me unpack what is going on here. I'm saying tmux new and giving this session a name of cloud and we're going to pass in a command and this is going to run cloud inside of our dev container instance. Now I'm enabling remote control and giving this session a name and I'm also allowing it to bypass my permissions so that it can run anything it needs on the VPS directly.

  10. So let's run this and you're going to see a green bar show up at the bottom. This is our tmux session. Then I have to acknowledge that I'm working in bypass permissions mode. I'll say I accept and we're back in Cloud Code except remote control is also active. So I'm going to ask Cloud Code what's in this repo and I'll give it a couple of moments to give me the answer and this is the response I get back. There's no application code here yet. The repo has one commit with three files all in .devcontainer. Together they set up a sandbox container for running Cloud Code on .NET Core. I will leave this session open and press control B then D and this is going to disconnect me from tmux. But if I do tmux LS it's going to list any open sessions and you can see that the one session we have called Cloud is still operational. If I open the Cloud Code app on my phone I can see the Cloud VPS remote control session is available and it contains the response that we previously got in the terminal. So what I'm going to do is drop a prompt I prepared ahead of time which is going to build a small application using .NET 11 and minimal APIs and it's going to show me the live resource usage on the server and it's also going to show any Cloud commands that are currently running inside of my sandbox. Now we can wait a couple of moments for this to finish building and I want to show you that we can also attach to the terminal session from tmux. So if I say tmux attach and

  11. pass it the session name you'll see that we'll be viewing the same session as I did from the Cloud Code app on my mobile phone. I can again disconnect from the session and that's not going to stop the work that's going on in the background. I can even exit my SSH session and go back to my machine and Cloud Code is still going to continue working. If I take a look on my phone I can see that the work is done and the application is available locally on port 5080. However this port is inside of the container on my VPS so I can't reach it locally. So I have to find a workaround and that workaround is actually pretty simple. You just SSH to your VPS. You find out the IP address in Docker for your container, which is going to be this IP address here, and then you use it to open up an SSH tunnel to that IP address on your VPS and point it to port 5080. Here's the command that's going to open up an SSH tunnel, and if everything works, I just shouldn't see nothing in the terminal like this, but as long as this SSH tunnel is open, I'll be able to reach my application. If I head over to the browser on localhost 5080, I can see the application that Claude built for me inside of the sandbox, and it's just a simple web app showing the live resource usage on my VPS. So if I go back to Claude Code on my phone and ask it what are the available resources on my server, we can see the spike in our resource usage as well as any commands

  12. that might show up as Claude Code tool calls. I'll also be able to see the response inside of Claude Code, and I'm going to give it one more prompt to build a small .NET application in .NET 11, and this is going to cause a more noticeable resource spike inside of our live viewer. This is actually going to build a .NET application. You can see it creating a new web API, setting up XUnit, and creating a tests project. It's also going to build the whole thing and run any tests, and it's going to report back when it completes. As the last step is going to do a .NET build and .NET test, and inside of Claude Code on my phone is going to report on the result of the test run, and you can see that we have three tests passing in total. Once we have our application built, one more thing we might need is actual web hosting for it, and Hostinger also offers web hosting where you can run your web applications. You can set up a connector that allows you to deploy your applications with one simple prompt, and if you're not happy within 30 days, you can get your money back, so you could give this a try practically for free. So this was quite a journey, but we We have Claude Code running an isolated sandbox inside of a secure VPS that we connect to over SSH. The whole thing is completely locked up and controlled by a firewall and everything we decide to expose to CloudCode. And I think this is how you should be running your agents in a commercial environment

  13. instead of running them on your developer's machines. This also lets you run your agents 24/7 and control them via remote control using your laptop or your mobile phone. If you enjoy this video, consider smashing that like button. Take a look at the Hostinger offers for an awesome VPS that's going to be in the pinned comment right below. Thanks a lot for watching and until next time, stay awesome.

Summary

This video discusses how to securely run AI coding agents like Cloud Code by isolating them within sandboxed virtual private servers rather than on a local development machine containing sensitive credentials. Key subjects and tools covered include setting up a Hostinger VPS, configuring Ubuntu, installing Docker, Node.js, and the Dev Container CLI, utilizing tmux for persistent sessions, and restricting network access via firewalls using a devcontainer.json configuration. The practical takeaway is that developers can protect their private SSH keys and confidential files by executing AI agents inside controlled, isolated dev containers with restricted network permissions.

View original episode ↗