---
title: "VS Code Remote SSH: edit and run code directly on your VPS | StreetHosting"
description: "Use the VS Code Remote SSH extension to edit code inside your VPS, open a remote terminal, forward ports and fix a stuck server or an out-of-memory crash."
url: "https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps"
type: "page"
language: "en-US"
---

VPS · 9 min · Beginner

Published on Nov 13, 2026 · Updated on Nov 13, 2026

# How to edit and run code directly on your VPS with VS Code Remote SSH

With the Remote SSH extension, VS Code opens the folder that lives on your VPS as if it were local, with the terminal, extensions and debugger running there. See the setup, the memory use and what to do when it hangs.

By [Equipe StreetHosting](https://streethosting.com.br/en/autores#equipe-streethosting) · StreetHosting infrastructure and support team

[Linux administration](https://streethosting.com.br/en/guides/topics/linux)

Summarize with:

[](https://chat.openai.com/?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "ChatGPT") [](https://claude.ai/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Claude") [](https://www.google.com/search?udm=50&aep=11&q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Google AI Mode") [](https://x.com/i/grok?text=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Grok") [](https://www.perplexity.ai/search/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Perplexity")

Share:

[](https://x.com/intent/tweet?text=VS%20Code%20Remote%20SSH%3A%20edit%20and%20run%20code%20directly%20on%20your%20VPS&url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps "Share on X") [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps "Share on Facebook") [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps "Share on LinkedIn") [](https://wa.me/?text=VS%20Code%20Remote%20SSH%3A%20edit%20and%20run%20code%20directly%20on%20your%20VPS%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fvs-code-remote-ssh-vps "Share on WhatsApp")

For agents: Copy as Markdown [.md](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps.md)

In this guide 7 sections

* [How Remote SSH works](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#o-que-e)
* [Connecting for the first time](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#conectar)
* [Working inside the VPS](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#trabalhar)
* [Forwarding ports](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#portas)
* [How much RAM it uses](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#memoria)
* [Common problems](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#problemas)
* [Where to run it](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#onde-rodar)

Quick answer

Install the **Remote - SSH** extension from Microsoft in VS Code, press `F1`, choose `Remote-SSH: Connect to Host` and enter the alias from your `~/.ssh/config` or `user@ip`. VS Code installs a small server on the VPS and starts opening folders, the terminal and extensions directly on it. The server usually takes a few hundred MB of RAM, and your app's ports are forwarded to your `localhost`.

## How Remote SSH works[](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#o-que-e)

The common way to work with a VPS is to edit the code on your computer, send it to the server and test it there. For every small tweak you repeat the cycle. Remote SSH changes that: VS Code on your computer opens an SSH connection, installs a component called the **VS Code Server** on the VPS and starts talking to it.

The result is that the folder open in the window is on the VPS. The integrated terminal runs commands on the VPS. Language extensions, such as Python or TypeScript autocomplete, run on the VPS and see the same environment where the code will execute, with the same versions of Node, Python and libraries. Your computer only draws the interface.

This helps when the project depends on something that only exists on the server, such as a local database, or when your computer is weak and the VPS builds faster. It also avoids the classic problem of working on your machine and failing on the server because of a version difference.

## Connecting for the first time[](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#conectar)

Before you start, SSH has to work in your terminal: if `ssh user@ip` does not get in, VS Code will not either. On Windows, the OpenSSH client comes with the system, and the guide on [SSH keys on Windows](https://streethosting.com.br/en/guides/vps/set-up-ssh-key-windows) shows how to get key login ready.

1. In VS Code, open the extensions tab, search for **Remote - SSH** and install the one from Microsoft.
2. Press `F1` and run `Remote-SSH: Connect to Host`.
3. The list shows every alias in your SSH config file. Pick one, or type `user@ip` on the spot.
4. A new VS Code window opens. If it asks about the server's system type, choose **Linux** and confirm the fingerprint on the first connection.
5. Wait for the remote server to install. The bottom-left corner then shows the host name, meaning you are connected.
6. Press F1, run `File: Open Folder` and choose a folder on the VPS, such as `/home/deploy/meuapp`.

Use the alias from the config file instead of typing user and IP every time. The guide on [SSH config for several servers](https://streethosting.com.br/en/guides/vps/ssh-config-multiple-servers) explains the format. Remote SSH reads that same file, so key, port and user come ready.

## Working inside the VPS[](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#trabalhar)

Once connected, VS Code behaves like it does on your computer, with a few differences worth knowing:

* **Integrated terminal:** press F1 and run `View: Toggle Terminal`. The keyboard shortcut shows up next to the command and depends on your keyboard layout. The terminal is already a VPS shell, in the project folder. This is where you run `npm install`, `git pull` or restart a service.
* **Separate extensions:** interface extensions, such as themes, stay on your computer. Language and tool extensions have to be installed on the VPS. In the extensions panel, the ones that are only on your computer get a button to install them on the connected SSH host.
* **Debugger and tests:** they run on the VPS, with the same environment as the production application.
* **Drag and drop files:** dragging a file from your computer into the VS Code explorer uploads the file to the VPS.

Editing on the VPS means a saved file is already live there. If the app runs from a folder with automatic reload, every Ctrl+S can restart the application that serves users. Keep a separate test environment and use Git for what goes to production.

One caution about long-running processes. What you run in the integrated terminal belongs to the VS Code session: when the window closes or the connection is gone for a long time, the process goes with it. It is the same problem as [keeping a process running after you close SSH](https://streethosting.com.br/en/guides/vps/tmux-keep-process-running-ssh). For anything that has to stay up, create a [systemd service](https://streethosting.com.br/en/guides/vps/create-systemd-service-linux) and use VS Code only to edit and restart it.

## Forwarding ports[](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#portas)

You are developing a site or an API that listens on port 3000 of the VPS. To open it in the browser you do not need to open the port in the firewall or expose the app to the internet: VS Code creates a tunnel through the SSH connection that already exists.

1. Start the app in the integrated terminal. In most cases VS Code detects the open port and tells you it forwarded it.
2. If it does not, press F1, run `Forward a Port` and type 3000. Forwarded ports show up in the ports panel, next to the terminal.
3. Open `http://localhost:3000` in your computer's browser. The request goes through the tunnel to the VPS.

It works for any TCP protocol, not just HTTP: you can forward a database port and use a graphical client on your computer, keeping the database listening only on `127.0.0.1` on the VPS. This is the safest way to reach panels and databases during development. Outside VS Code, the same feature exists in SSH with `ssh -L 3000:localhost:3000 alias`.

## How much RAM it uses[](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#memoria)

The VS Code Server is not a tiny, lightweight program like plain SSH. It runs Node processes to serve the editor, and language extensions run in a process of their own. As an order of magnitude, count on a few hundred MB of RAM on a small project, and more than that when there are many extensions or a project with thousands of files, because the server indexes and watches changes in all of them. There is no fixed number: it depends on the installed extensions, the language and the size of the project.

To measure it in your case, connect, open the project and run in the integrated terminal `free -h` and `ps aux --sort=-%mem | head`. The server processes show up with `.vscode-server` in the path. The guide on [checking CPU, RAM and disk on Linux](https://streethosting.com.br/en/guides/vps/check-cpu-ram-disk-network-linux) helps you read that output.

* **Cut down the extensions on the VPS:** install there only what you really use for that language.
* **Exclude heavy folders from watching:** in settings, search for `files.watcherExclude` and add folders such as node\_modules and dist.
* **Consider a VPS with more headroom:** if the app, the database and the editor share 1 or 2 GB, the math gets tight.

## Common problems[](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#problemas)

* **The connection drops or the server ends by itself:** it is usually lack of memory. The system kills the process that uses the most, and VS Code shows that it lost the connection. See whether the kernel logged it with `sudo dmesg | grep -i "killed process"`. The way out is to add virtual memory, as in the guide on [swap on Ubuntu](https://streethosting.com.br/en/guides/vps/set-up-swap-ubuntu-vps), or move to a VPS with more RAM.
* **It asks for the password all the time or refuses the key:** Remote SSH opens several connections and each one may ask for the key passphrase. Use a key agent and `IdentitiesOnly yes` in the host block, as in the ssh config guide, and check that `ssh alias` gets in from a regular terminal.
* **It stays stuck on "Setting up SSH Host" or "Installing VS Code Server":** the installation may be corrupted, or the VPS could not download the server. Test `curl -I https://update.code.visualstudio.com` on the VPS to check for outbound internet access, and then clean the installation, as shown below.
* **Full disk:** the `~/.vscode-server` folder keeps old server versions and the extensions. If the disk runs out, the new installation fails.
* **Old system version:** recent VS Code Server versions require a fairly new Linux. On Ubuntu 22.04 and 24.04 there is no issue, but very old distributions may refuse the connection with a message about the system library.

To clean a stuck installation, first try it from VS Code itself: press F1 and run `Remote-SSH: Kill VS Code Server on Host`. If even that does not work, connect from a regular SSH terminal and delete the folder:

`# ends server processes that got stuck pkill -f vscode-server # deletes the installation; VS Code downloads everything again on the next connection rm -rf ~/.vscode-server`

On the next connection VS Code reinstalls the server from scratch. You lose the remote extensions, which have to be installed again, and the settings saved only for that machine. Your files and project settings are not kept in that folder.

## Where to run it[](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#onde-rodar)

Remote SSH needs a Linux server with SSH open, outbound internet access to download the server and enough RAM for the editor and the app together. On [StreetHosting VPS](https://streethosting.com.br/en/vps) you get root access on KVM, a dedicated IPv4 and the freedom to install whatever the project asks for.

* **Small projects and tests:** the Xeon VPS, from R$ 26.00 per month, has 2 vCPU, 2 GB of RAM and 20 GB of NVMe.
* **Developing with room to spare:** the [Ryzen 9 9950X VPS](https://streethosting.com.br/en/vps/ryzen) starts at R$ 43.00 per month, with 1 vCPU and 2 GB of DDR5, and goes up to 64 GB of RAM for larger projects.

All of them are in São Paulo, with AntiDDoS included, up to 5 TB of traffic per month and activation in about 60 seconds after Pix or card approval.

In this guide

* [How Remote SSH works](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#o-que-e)
* [Connecting for the first time](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#conectar)
* [Working inside the VPS](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#trabalhar)
* [Forwarding ports](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#portas)
* [How much RAM it uses](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#memoria)
* [Common problems](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#problemas)
* [Where to run it](https://streethosting.com.br/en/guides/vps/vs-code-remote-ssh-vps#onde-rodar)

## Frequently asked questions

Is Remote SSH free?

The Remote - SSH extension is free and comes from Microsoft itself, like VS Code. You only pay for the VPS. The server VS Code installs on the VPS has no cost either.

Do I need to install VS Code on the VPS?

No. You install VS Code on your computer. On the first connection it downloads and installs a small server on the VPS by itself, the VS Code Server, inside the \~/.vscode-server folder of the user who connected.

Does my code live on the VPS or on my computer?

On the VPS. VS Code on your computer works as the screen and keyboard: the files, the terminal, the language extensions and the execution all stay on the server. That is why it is worth keeping backups and using Git.

How do I open the site running on the VPS in my browser?

Through port forwarding. If the app listens on port 3000 of the VPS, VS Code forwards it to port 3000 of your computer, and you open http://localhost:3000 in the local browser, without opening anything in the server firewall.

Does VS Code Remote SSH work on a VPS with 1 GB of RAM?

It works for small projects, but it sits at the limit, especially with several extensions. If the server hangs or the connection drops, the cause is usually lack of memory. Turn on swap or use a VPS with more RAM.

Next step

See VPS plans

Root VPS in Brazil with NVMe and Anti-DDoS.

[See VPS plans](https://streethosting.com.br/en/vps)

[See Ryzen VPS Ryzen 9 9950X VPS in São Paulo with root access, NVMe and gamer Anti-DDoS.](https://streethosting.com.br/en/vps/ryzen)

## Related guides

[VPS Beginner SSH config file: reach several servers with a short name Stop memorizing IPs, ports and key paths. With one block per server in the SSH config file you connect with ssh prod, and the same alias works in scp, rsync and VS Code. 8 min Read guide](https://streethosting.com.br/en/guides/vps/ssh-config-multiple-servers) [VPS Beginner Set up an SSH key on Windows to access your VPS Windows already ships the OpenSSH client, so you can generate and use keys without installing anything. Here is the step by step in PowerShell, the most common permission errors and the path for anyone who prefers PuTTY. 9 min Read guide](https://streethosting.com.br/en/guides/vps/set-up-ssh-key-windows) [VPS Intermediate How to set up swap on Ubuntu on a VPS Swap does not replace RAM, but it helps during peaks and can keep services from crashing when memory runs out. 2 min Read guide](https://streethosting.com.br/en/guides/vps/set-up-swap-ubuntu-vps)

[← Back to the Guide Center](https://streethosting.com.br/en/guides)
