Linux, SSH & Remote GPU Machines

The machine this course's model needs is probably not the one you are reading this on. Serious GPUs live in data centers, are rented by the hour, and run Linux; the working setup of this field is a laptop driving a remote Linux box over SSH. This lesson gets you onto such a box and comfortable enough on it that the next two lessons can make its GPU usable and verified.

This is ordinary system administration, the same short list practitioners run daily: keys, sessions, transfers, readings. Each one below is the form the course will assume from the next module onward.

Renting a machine

GPU boxes are rented from cloud providers by the hour and stopped when idle: you pay for hours, not months. Three criteria matter when picking an instance: the GPU class (the H100 canon of this course sits near the expensive end of the menu; far smaller cards run the early modules), the disk size (weights are tens of gigabytes each by the table from memory and throughput arithmetic, and caches accumulate), and per-hour billing you can stop.

Providers in this class include Lambda, RunPod, and Vast.ai; the interface is the same everywhere: pick an instance, receive an IP address and a user (sometimes with a port number, which a Port line in the config below captures), connect with SSH. Resist the instinct to over-rent. Everything up to this point of the course needs no GPU at all, and running your first LLM needs one modest GPU for a few hours (24 GB of VRAM covers it), not a cluster. Renting small and stopping instances when done is the habit that keeps this field's utility bill survivable, at learning scale as at fleet scale.

Keys and the SSH config

SSH authenticates with a keypair: a private file that never leaves your laptop and a public line you hand to the remote machine.

Cloud dashboards usually take the public key at instance creation instead of ssh-copy-id; either way the private key stays home, and SSH itself enforces its permissions (if ssh refuses a key with a permissions warning, chmod 600 on the private key file fixes it). The ~/.ssh/config file then turns the address into a name:

From here on, ssh gpubox connects, and everything below (scp, rsync, port forwarding) understands the same alias.

Sessions that survive

An SSH connection dies when your laptop sleeps, and by default everything it was running dies with it. A model download or a long job must not depend on your connection, so remote work runs inside tmux, a terminal that lives on the server:

Start tmux first and work inside it always; for a single command that must outlive the session, nohup command & is the one-line alternative.

Moving bytes

Files move over the same SSH channel. scp copies; rsync copies resumably, which matters at these file sizes:

Run the napkin before any large transfer. The course's 16 GB weights file at a real-world 50 MB/s is 320 seconds, about five minutes; even a full 1 Gbps line needs about two (network lines are quoted in bits: 1 Gbps is 125 MB/s). That is why model weights are almost never pushed from a laptop: the box downloads them straight from the hub itself, which is the first thing the next module does, and your uploads stay small (code, configs, prompts).

Disk is the constraint transfers run into. df -h shows what the box has left; du -sh ~/.cache/huggingface shows what downloads have accumulated, because that cache directory is where models land and it grows until you prune it.

Port forwarding

Running your first LLM will run a model server on the box, listening on a port there, while your browser and scripts live on the laptop. The box's ports are not open to the internet, and you do not want them to be. One SSH flag closes that gap:

While that connection is open, localhost:8000 on your laptop is port 8000 on the box, and the server the next module starts there will answer your local browser and scripts through exactly this line.

Reading the machine

Two readings cover the rest of daily needs: htop for CPU and memory (and for confirming a process is actually running), and echo $PATH when a tool cannot be found; installs on a fresh box often land outside the default search path. The GPU has its own reading, nvidia-smi, and it deserves more than a glance: reading it correctly is where the next lesson begins.

The box now answers to a name, survives disconnects, moves files, and forwards ports. What it cannot do yet is prove that PyTorch can see its GPU: that is a four-layer software stack with its own failure modes, and it is the last prerequisite before the lab.