# SSH into a rented GPU: scp, rsync, port forwarding and VS Code

> Connect to a rented GPU from your own terminal: one command for SSH, then scp, rsync, port forwarding and VS Code Remote-SSH — no open ports.

Source: https://rentgpupower.com/guides/ssh-into-a-rented-gpu — updated 2026-11-08 — RentGPUPower

Every rental already has a terminal in the browser. When you want your own tools — your terminal, scp and rsync for files, a forwarded port, or VS Code — use SSH. It travels through RentGPUPower, so nothing is opened on the host's router or on yours, and it works behind any network.

## What you need

- **A rental on a machine with the Docker sandbox.** Every machine on the marketplace has it (AI devices, rented as a model, have no shell). SSH runs inside your rental's own container, never on the host's system.
- **An API key** from the [developers page](https://rentgpupower.com/developers) — a full key, not a read-only one.
- **Node.js 22 or newer**, and the `ssh` client that comes with Windows 10 and 11, macOS and Linux.

## 1. Install the command line

On macOS or Linux:

```bash
mkdir -p ~/bin && curl -fsSL https://rentgpupower.com/cli/gpurent.js -o ~/bin/gpurent && chmod +x ~/bin/gpurent
export PATH="$HOME/bin:$PATH" GPURENT_API_KEY=gpuapi_...
```

On Windows, in PowerShell:

```powershell
iwr -UseBasicParsing https://rentgpupower.com/cli/gpurent.js -OutFile $HOME\gpurent.js
$env:GPURENT_API_KEY = "gpuapi_..."
```

On Windows, type `node $HOME\gpurent.js` wherever this guide says `gpurent`.

## 2. Connect

Your rental's number is in the address of its page (/rental/123), and the SSH panel on that page shows these commands with the number filled in.

```bash
gpurent ssh 123
```

The first time, this adds your public key — ~/.ssh/id_ed25519.pub (or id_rsa.pub), or the key you name with `--identity`; if you have none, it makes one — and turns SSH on in your rental's container. That takes about half a minute: an SSH server is installed inside your container, accepting keys only, never passwords. Then you are in, as root, in your own container.

To run a single command and come back: `gpurent ssh 123 -- nvidia-smi`.

## 3. Use plain ssh, scp, rsync and VS Code

```bash
gpurent ssh-config 123 >> ~/.ssh/config
```

This adds a `Host gpurent-123` block whose ProxyCommand carries the connection through the site. (In Windows PowerShell, `>>` writes a format ssh cannot read: pipe into `Add-Content -Encoding ascii $HOME\.ssh\config` instead.) From then on, the usual tools just work:

```bash
ssh gpurent-123
scp model.safetensors gpurent-123:/workspace/
rsync -avP ./dataset/ gpurent-123:/workspace/dataset/
```

scp and rsync handle files of any size, and `rsync -P` picks up where an interrupted copy stopped when you run it again. rsync must exist inside the container too: `apt-get install -y rsync` adds it if your image lacks it.

**VS Code and Cursor:** install the Remote-SSH extension in either, run `Remote-SSH: Connect to Host…` and choose `gpurent-123` — or press **Open in VS Code** or **Open in Cursor** in the SSH panel of the rental's page, which opens /workspace straight away. The editor starts the ProxyCommand without your shell's environment, so also save your API key in `~/.gpurent/api_key` — the command line reminds you.

## Port forwarding

A notebook, TensorBoard or any web app running on the GPU can open on your own computer:

```bash
ssh -L 8888:127.0.0.1:8888 gpurent-123
```

Then browse to `http://127.0.0.1:8888`. Without SSH, the command line forwards a single port by itself: `gpurent tunnel 123 8888` (add `--local 9000` to use another port on your side). For the tunnel, the app must listen on 0.0.0.0, not only on 127.0.0.1.

## Long jobs

A program started in an SSH session stops when the session closes. For a training run, start it in the background and check on it whenever you reconnect:

```bash
nohup python train.py > train.log 2>&1 &
tail -f train.log
```

## Before the rental ends

/workspace keeps your files for the whole rental, across sessions and reconnects, and is deleted when it ends. Copy results back with scp or rsync, or save them to My Drive from the rental page, before your time runs out. Coming back to the same machine? Switch on **Keep my files after this rental** on the rental page, and /workspace is there as you left it the next time you rent it — [how it works](https://rentgpupower.com/guides/keep-your-files-between-rentals). For what to run once you are in, see [Fine-tune an LLM on a rented GPU](https://rentgpupower.com/guides/fine-tune-an-llm-on-a-rented-gpu) or [Rent a GPU with your own Docker image](https://rentgpupower.com/guides/rent-a-gpu-with-your-own-docker-image).

## FAQ

### Does the host have to open a port?

No. The connection rides the host machine's own outgoing connection through RentGPUPower, and only your key gets in. Nothing is opened on anyone's router.

### Why can I not turn SSH on?

Your image has no package manager to install an SSH server with — use an image with apt, apk, dnf or yum, or one that already contains openssh-server. The browser terminal on the rental page is still there.

### ssh says `SSH is not running there`

Your container was started again — its machine restarted, or the host's app had to stop everything in it — and the SSH server went with everything else. Your files in /workspace are still there. Run `gpurent ssh 123` once: it starts SSH again, and ssh, scp, rsync and VS Code reach it as before. If the message says instead that the machine's disk is nearly full, your work was stopped to protect its owner's drive: delete files in /workspace to make room, then start it again.

### Can I sign in with a password?

No. SSH here accepts keys only.

### Does SSH cost extra?

No. You pay the rental's hourly price and nothing on top.
