Real compute doesn't live on your laptop. HPC clusters, cloud GPU instances — all accessed via SSH.
What Is SSH?
SSH (Secure Shell) gives you a secure, encrypted terminal session on a remote machine. Every engineer needs it.
ssh alice@192.168.1.50
ssh alice@cluster.university.edu
ssh alice@10.0.0.5 -p 2222
exit
SSH Key Authentication
Step 1: Generate a key pair:
ssh-keygen -t ed25519 -C "alice@mylaptop"
This creates ~/.ssh/id_ed25519 (private — never share) and ~/.ssh/id_ed25519.pub (public — goes on servers).
Step 2: Copy the public key to the server:
ssh-copy-id alice@192.168.1.50
Step 3: Connect without a password. SSH will use your key pair automatically.
Warning: Protect your private key. Run chmod 600 ~/.ssh/id_ed25519 to ensure only you can read it. Never share it, never copy it to servers.
SSH Config (~/.ssh/config)
Instead of typing long SSH commands every time, define aliases in your config file:
Host myserver
HostName 192.168.1.50
User alice
IdentityFile ~/.ssh/id_ed25519
Host cluster
HostName hpc.university.edu
User a.chen
ForwardAgent yes
Host gpu-box
HostName 10.0.0.15
User ubuntu
Port 2222
Then simply:
ssh myserver
Key takeaway: Set up SSH config for every machine you connect to regularly. It saves time and reduces errors.
Transferring Files
scp
scp copies files over SSH — simple and works everywhere:
scp results.csv alice@myserver:~/data/
scp alice@myserver:~/output/sim.log ./
scp -r ./results/ alice@myserver:~/project/
rsync (smarter)
rsync is the better choice for most transfers — it only sends what changed:
rsync -av ./results/ alice@myserver:~/project/results/
rsync -av --progress ./big-dataset/ alice@myserver:~/data/
rsync -av --delete ./local-dir/ alice@myserver:~/remote-dir/
Tip: Use rsync for anything larger than a few files. It's resumable, incremental, and faster than scp for repeated transfers.
Basic Networking
A handful of networking commands you'll use constantly:
ping google.com
curl https://api.example.com
wget https://example.com/file.zip
ss -tlnp
ip addr
Remote Development with VS Code
The VS Code Remote-SSH extension lets you edit files on a remote machine as if they were local:
- Install the Remote-SSH extension in VS Code.
- Press Ctrl+Shift+P and select Remote-SSH: Connect to Host.
- Type your SSH config alias (e.g.,
myserver).
Tip: Best of both worlds — a modern GUI editor with the power of a Linux server. Your code runs on the remote machine, but you edit it locally.
Try It Yourself
Set up passwordless SSH access and a config shortcut.
Option A (real server):
- Generate an SSH key pair with
ssh-keygen -t ed25519. - Copy it to the server with
ssh-copy-id user@server. - Add a config entry in
~/.ssh/config. - Connect using your alias:
ssh myalias.
Option B (GitHub):
- Generate an SSH key pair with
ssh-keygen -t ed25519. - Add the public key to your GitHub account under Settings → SSH and GPG keys.
- Test the connection:
ssh -T git@github.com.
Quick Quiz
Where does the public key go, and where does the private key stay?
Answer
C) The public key goes on the server in ~/.ssh/authorized_keys; the private key stays on your local machine and is never shared.