SadServers
  • Scenarios
  • Labs
    All Labs Linux & Bash Web Servers Databases Data Processing Docker Kubernetes CI/CD Infrastructure as Code Tooling / Applications
  • Dashboard
  • Solutions
    For Individuals For Businesses
  • Ranking
  • Newsletter
  • Documentation
    FAQ Support Pro Accounts Pro+ Accounts Business Accounts Gift API CLI/TUI Privacy Troubleshooting Interviews
  • Blog
  • Pricing
  • Gift
    Gift Purchase Gift Redeem
  • About
Log In - Sign Up
  1. Labs
  2. SSH
  3. Cheatsheet

Guide

Concepts and learning path

Troubleshooting

Failure modes and fixes

Cheatsheet

Commands to keep handy

SSH cheatsheet

Connecting

CommandDescription
ssh user@hostInteractive login
ssh -p 2222 user@hostConnect on custom port
ssh -i ~/.ssh/deploy_key user@hostUse specific private key
ssh user@host 'uptime'Run remote command
ssh -J bastion user@internalJump through bastion (ProxyJump)
ssh -L 8080:localhost:80 user@hostLocal port forward
ssh -R 9000:localhost:3000 user@hostRemote port forward

Keys

CommandDescription
ssh-keygen -t ed25519 -C "you@host"Generate Ed25519 key pair
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@hostInstall public key on server
ssh-keygen -lf ~/.ssh/id_ed25519.pubShow key fingerprint
ssh-add ~/.ssh/id_ed25519Add key to ssh-agent
ssh-add -lList loaded agent keys

File transfer

CommandDescription
scp file user@host:/path/Copy file to remote
scp -r dir/ user@host:/path/Copy directory recursively
scp -P 2222 file user@host:scp with custom port
sftp user@hostInteractive SFTP session
rsync -avz -e ssh src/ user@host:dest/Sync over SSH

Server management

CommandDescription
systemctl status sshSSH service status (Debian/Ubuntu)
systemctl status sshdSSH service status (RHEL/CentOS)
sshd -tTest sshd_config syntax
ss -tlnp | grep :22Confirm sshd is listening
journalctl -u ssh -n 50Recent SSH logs (systemd)

Debugging

CommandDescription
ssh -v user@hostVerbose connection debug
ssh -vvv user@hostMaximum verbosity
ssh-keygen -R hostRemove stale known_hosts entry
grep sshd /var/log/auth.logAuth log (Debian/Ubuntu)
grep sshd /var/log/secureAuth log (RHEL/CentOS)

Example ~/.ssh/config

Host bastion HostName jump.example.com User deploy IdentityFile ~/.ssh/deploy_ed25519 Host app-* User ubuntu ProxyJump bastion IdentityFile ~/.ssh/deploy_ed25519

Pro tips

  • Prefer Ed25519 keys over RSA unless legacy systems require RSA
  • Use ssh -vvv on the client and auth logs on the server together
  • Run sshd -t before reloading sshd — a syntax error can lock you out
  • Keep a second session open when changing sshd_config remotely

Practice scenarios

Hands-on SSH scenarios on live Linux VMs: ssh

SadServersSadServers

Real-world Linux and DevOps scenarios for hands-on learning and technical assessment.

Uptime Robot ratio (30 days)
Product
  • Scenarios
  • For Individuals
  • For Businesses
  • Pricing
Resources
  • FAQ
  • Blog
  • Newsletter
Company
  • About Us
  • Support
  • Privacy Policy
  • Terms of Service
  • Contact
Connect With Us
info@sadservers.com

Made in Canada 🇨🇦
Updated: 2026-06-13 16:06 UTC – 2d2950a