Hey engineer,
SSH is your gateway to every box you own so why are we still typing ssh user@host
and calling it a day?
Here’s a list of 10 useful SSH flags that’ll make you faster, safer, and a little bit sneakier when you need to be.
1. -o StrictHostKeyChecking=no
Skip annoying fingerprint prompts (CI/CD, auto-scripts):
ssh -o StrictHostKeyChecking=no user@host
2. -i ~/.ssh/id_rsa_custom
Use a specific private key:
ssh -i ~/.ssh/id_rsa_prod user@host
3. -o ConnectTimeout=5
Don’t hang forever on unreachable hosts:
ssh -o ConnectTimeout=5 user@host
4. -q
Quiet mode (great for clean script output):
ssh -q user@host uptime
5. -t
Force pseudo-terminal (needed for interactive commands):
ssh -t user@host "sudo systemctl restart nginx"
6. -J
(Jump Host / Bastion)
ssh -J bastion@bastion.company.com dev@app.internal
Chains SSH connections through a bastion host.
7. -L
(Local Port Forwarding)
ssh -L 8080:localhost:9200 user@remote
Tunnel remote services to your local machine.
8. -D 1080
SOCKS proxy (browse via your server):
ssh -D 1080 user@host
Use with browser proxy settings for secure traffic routing.
9. -N
Don’t run a remote command (perfect for port forwards):
ssh -N -L 3306:localhost:3306 user@db-server
10. -f
Run SSH in the background after authentication:
ssh -f -N -L 5432:localhost:5432 user@db
Bonus Tip: Combine with SSH config
Use ~/.ssh/config
to create aliases with all the flags baked in:
Host prod
HostName 10.1.2.3
User admin
IdentityFile ~/.ssh/id_rsa_prod
StrictHostKeyChecking no
Now just:
ssh prod
SSH is a toolkit, not just a login.
Use it with precision and win back time on every box you touch.
Stay sharp…
P.S. I recently released a DevOps Starter Kit — a bundle of 20+ Bash scripts, cron jobs, and Docker templates to speed up your infrastructure setup.
If you do a lot of server work, you might find it useful.
No need to spend hours manually hardening servers
With this Security Hardening Kit, containing production-level Bash scripts, you can automate it in 1 hour.
Grab it here 👉