SSH Cheatsheet

Basics

Use this SSH reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.

What SSH Is

SSH (Secure Shell) is a cryptographic network protocol for operating network services securely over an unsecured network. It replaces Telnet, rsh, and rlogin.

For software engineering work, SSH is the everyday path to deploy portfolio apps, inspect server logs, copy build artifacts, and debug cloud machines without exposing passwords.

  • Port 22 by default (TCP)
  • Three layers: transport (encryption), user auth, connection (channels/multiplexing)
  • Server daemon: sshd; client binary: ssh

Career and Portfolio Relevance

SSH is worth naming in career materials only when you can tie it to real engineering work: deployed an app, configured key-based authentication, debugged production logs, or secured a server. Those details make stronger software engineer resume bullets, help an ATS resume for software engineer roles match concrete infrastructure skills, and give a LinkedIn profile review, mock coding interview, or technical interview prep session something specific to discuss.

Essential Vocabulary

TermMeaning
known_hostsClient-side file of trusted server fingerprints
authorized_keysServer-side file of client public keys that may log in
identity fileYour private key (default: ~/.ssh/id_ed25519)
Host fingerprintSHA-256 hash of the server's host public key
Jump host / bastionIntermediate host used to reach a private network

Quick Connection

ssh user@host                    # basic login
ssh -p 2222 user@host            # non-default port
ssh host                         # user defaults to $USER; host from ~/.ssh/config
ssh -i ~/.ssh/mykey user@host    # specify identity file
ssh -v user@host                 # verbose (add up to -vvv for more detail)

Run a Remote Command Without a Shell

ssh user@host 'df -h'
ssh user@host 'ls -la /var/log' | grep auth
ssh user@host 'sudo systemctl restart nginx'

The remote command runs non-interactively; the connection closes when it exits.

Escape Sequences (Inside a Live Session)

All escape sequences begin with ~ (the escape character), typed after a newline.

SequenceAction
~.Terminate connection
~COpen SSH command line (for dynamic tunnels etc.)
~&Background the SSH session
~#List forwarded connections
~~Send a literal ~

Config File Locations

FilePurpose
~/.ssh/configPer-user client config
/etc/ssh/ssh_configSystem-wide client config
/etc/ssh/sshd_configServer daemon config
~/.ssh/known_hostsTrusted server host keys
~/.ssh/authorized_keysPublic keys allowed to log in as this user
~/.ssh/id_ed25519Default Ed25519 private key
~/.ssh/id_ed25519.pubCorresponding public key

Permissions (Critical)

Wrong permissions cause silent auth failures.

chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519          # private key
chmod 644 ~/.ssh/id_ed25519.pub      # public key (optional)
chmod 600 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/config
chmod 644 ~/.ssh/known_hosts

Protocol Versions

Only SSH-2 is used in practice. SSH-1 is broken and removed from modern OpenSSH. The version in use is negotiated automatically — no action needed.