Remote Access, SSH & RDP
Real servers live inside locked data centers or cloud racks with no monitor, no mouse, and no keyboard. Learn how admins securely control Linux and Windows servers from thousands of miles away using SSH keys, Bastion jump hosts, RDP, and WinRM.
Start Module 05 ↓01 Why Servers Have No Monitor (SSH vs RDP vs Telnet)
Define: What is a Headless Server?
A headless server is a computer running in a data center or cloud provider (like AWS, Azure, or Hetzner) without a monitor, keyboard, or mouse attached. Instead of walking into a cold, noisy server room with a crash cart, you connect over the network using a remote access protocol.
Understand: The Postcard vs Sealed Armored Envelope Analogy
Imagine sending your bank PIN through the mail:
- Telnet (Port 23) = Writing on a Postcard: Every word you type — including your username and password — travels across the internet in plain text. Anyone on the same Wi-Fi or router can read it effortlessly. Never use Telnet for admin login.
- SSH (Port 22) = Sealed Armored Envelope (CLI): Everything is encrypted end-to-end before it leaves your laptop. You get a fast, lightweight text terminal to control Linux (and modern Windows) servers.
- RDP (Port 3389) = Encrypted Live Video Stream (GUI): Remote Desktop Protocol streams the full graphical desktop of a Windows Server to your screen, sending your mouse clicks and keystrokes back inside an encrypted tunnel.
Know: Protocol & Port Comparison
| Protocol | Default Port | Encryption | Interface Type | 2026 Verdict |
|---|---|---|---|---|
| SSH (Secure Shell) | TCP 22 |
Strong (AES / ChaCha20) | Command Line (CLI) | Gold Standard (Linux & Cloud) |
| RDP (Remote Desktop) | TCP/UDP 3389 |
TLS + NLA | Full Graphical Desktop (GUI) | Standard for Windows GUI (behind VPN/Bastion) |
| Telnet | TCP 23 |
None (Plaintext!) | Command Line (CLI) | Obsolete & Dangerous (Never Expose) |
🧠 Memory Trick: "22 for Two-way Shell, 23 is Plaintext Trouble, 3389 for Windows Screen"
SSH = 22 (the year-round standard for secure shells), Telnet = 23 (one number higher, zero encryption), and RDP = 3389 (Windows Remote Desktop).
When & Execute
Use SSH whenever you manage Linux servers, containers, or network gear, or when you want fast, low-bandwidth automation. Use RDP only when you genuinely need a Windows graphical wizard — and never expose Port 3389 directly to the open internet.
✓ Checkpoint: Can you...
- Explain why production servers run "headless" without monitors or keyboards?
- State the default ports for SSH (22), Telnet (23), and RDP (3389)?
- Explain why Telnet is banned in modern server administration?
02 Password vs SSH Key Pairs (Padlock & Key Analogy)
Define: Asymmetric Key Authentication
An SSH Key Pair consists of two mathematically linked cryptographic files generated together: a Public Key (safe to share everywhere) and a Private Key (must never leave your device). Together, they replace guessable passwords with cryptographic proof.
Understand: The Padlock & Unique Key Analogy
Think of your Public Key (id_ed25519.pub) as an open padlock
with your name on it. You can hand out copies of that padlock to 50 different servers and lock their
front doors with it. Even if a hacker steals the padlock from a server, they cannot open the door —
because only your Private Key (id_ed25519), sitting safely inside your
laptop's ~/.ssh/ folder, can unlock it.
Know: Why Ed25519 Beats Legacy RSA
Older tutorials use ssh-keygen -t rsa -b 4096, which creates huge, slow keys. In 2026,
Ed25519 is the modern default: it is shorter, faster, and cryptographically
stronger against side-channel attacks.
chmod 600 ~/.ssh/id_ed25519). OpenSSH will actually refuse to use a private key if
other users on your laptop can read it!
03 Practical SSH Workflow & File Transfers
Define: The 4-Step Daily Admin Loop
Once you learn four core commands — ssh-keygen, ssh-copy-id,
~/.ssh/config, and scp/sftp — you can manage any Linux or
cloud server in seconds without typing long IP addresses or passwords.
Execute: Commands You Will Use Every Day
# 1. Generate a modern Ed25519 key pair with a comment label
ssh-keygen -t ed25519 -C "shekhar@work-laptop"
# 2. Copy your public key to the server (sets exact permissions automatically)
ssh-copy-id -i ~/.ssh/id_ed25519.pub [email protected]
# 3. Copy a local file to the server over SSH (scp)
scp ./nginx.conf prod-web:/tmp/nginx.conf
# 4. Open an interactive encrypted file browser (sftp)
sftp prod-web
Instead of memorizing ssh -i ~/.ssh/id_ed25519 -p 2222 [email protected], create a
file at ~/.ssh/config (on Linux, macOS, and Windows OpenSSH):
Host prod-web
HostName 203.0.113.50
User admin
Port 2222
IdentityFile ~/.ssh/id_ed25519
Now typing ssh prod-web or scp file.txt prod-web:/var/www/ works
instantly.
04 Jump Hosts (Bastion Servers) & SSH Hardening
Define: What is a Bastion / Jump Host?
A Bastion Host (also called a Jump Host) is a single, heavily hardened server sitting at the edge of your network. It is the only machine with a public IP address accepting SSH. Your actual database and application servers live inside a private subnet with no public IP, unreachable directly from the internet.
Understand: The Airport Security Checkpoint Analogy
You do not let passengers walk straight from the street onto the airplane runway. Everyone must pass
through one guarded security checkpoint (the Bastion Host) first. Once verified, you
are routed inside the secure terminal to your gate (private servers). With OpenSSH's
ProxyJump (-J), this two-hop tunnel happens transparently in a single
command — and your private key never gets copied onto the Bastion!
Know & Execute: Essential SSH Hardening (/etc/ssh/sshd_config)
After copying your SSH key and confirming key login works, harden your Linux SSH server so brute-force bots hit a brick wall:
# Edit /etc/ssh/sshd_config (or a drop-in file in /etc/ssh/sshd_config.d/)
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
MaxAuthTries 3
# Validate syntax BEFORE restarting (prevents locking yourself out!)
sudo sshd -t
sudo systemctl reload sshd
sshd_config rules! Keep your existing terminal open, reload sshd, and test
logging in from a second terminal window first.
📝 Practice Problem: Configuring a One-Command Jump Host
Given: Your company's Bastion Host is at 203.0.113.10 (user
ops), and your private Database Server is at 10.0.2.25 (user
dbadmin).
Find: How do you configure ~/.ssh/config
so typing ssh prod-db tunnels through the Bastion automatically?
Show Solution
Define the Bastion host first, then reference it with ProxyJump:
Host bastion
HostName 203.0.113.10
User ops
IdentityFile ~/.ssh/id_ed25519
Host prod-db
HostName 10.0.2.25
User dbadmin
ProxyJump bastion
IdentityFile ~/.ssh/id_ed25519
Now running ssh prod-db (or even
ssh -J [email protected] [email protected]) creates an end-to-end encrypted
tunnel without ever storing your private key on the Bastion.
05 Windows Server Remote Management (RDP, NLA & WinRM)
Define: RDP vs PowerShell Remoting (WinRM)
Windows Server supports two primary remote management paths: RDP (Remote Desktop Protocol, Port 3389) when you need a full graphical desktop, and WinRM (Windows Remote Management / PowerShell Remoting, Ports 5985/5986) when you want fast, scriptable command-line control across dozens of servers at once.
Understand: Network Level Authentication (NLA)
Without NLA (Network Level Authentication), an RDP server loads the entire Windows login screen before checking who you are — wasting memory and exposing the login UI to attackers. With NLA enabled, the server acts like a bouncer at the door: it verifies your credentials before creating a full graphical session.
Know & Execute: PowerShell Remoting Commands
Windows Server 2012 R2 through 2025 enables WinRM by default. If you need to enable it on a machine or run commands across multiple servers at once:
# Enable PowerShell Remoting on a Windows host
Enable-PSRemoting -Force
# Open an interactive remote PowerShell session (like SSH for Windows)
Enter-PSSession -ComputerName SRV-WEB01 -Credential (Get-Credential)
# Run a single command across 3 servers simultaneously
Invoke-Command -ComputerName SRV01, SRV02, SRV03 -ScriptBlock { Get-Service w32time }
ssh and scp workflow you use on Linux!