SSH
Cheat sheet · https://pcornel.dk/topic.php?topic=746
Answer
SSH (Secure Shell) version 2 gives encrypted, authenticated CLI access to a device. On Cisco IOS it needs a hostname, a domain name, an RSA key pair and transport input ssh on the VTY lines.
Remember
Setup: hostname, ip domain name, crypto key generate rsa modulus 2048 (or larger), ip ssh version 2, line vty 0 15 + transport input ssh + login local or AAA, plus a VTY access-class. SSH failing after a hostname or domain change usually means the key is missing. Clients warn when the host key changes — check before accepting.
First checks
show ip ssh— SSH enabled, version 2, timeout and retries.show ssh— active SSH sessions with version and cipher.show crypto key mypubkey rsa— the RSA key used by SSH.show running-config | section line vty— transport input, access-class and login method on every VTY range.show users— logged-in users and their source address.
Commands
exec-timeout <minutes> <seconds>- Disconnect idle line sessions after the given time.
login local- Authenticate line logins against local usernames.
hostname <hostname>- Set the device hostname, required before generating RSA keys for SSH.
ip domain-name <domain>- Set the domain name, required before generating RSA keys for SSH.
username <user> secret <password>- Create a local user with a hashed secret (used for SSH logins).
crypto key generate rsa modulus 2048- Generate an RSA key pair, required before SSH can be enabled; use 2048 bits or more.
ip ssh version 2- Allow only SSH version 2.
line vty 0 15- Enter configuration for VTY lines 0–15 (remote management sessions).
transport input ssh- Allow only SSH on the lines.
show ip ssh- Display SSH version and settings.
show ssh- Display active SSH sessions.
ip ssh time-outip scp server enableshow users
Verify in this order
hostname and domain set → RSA key generated → SSH v2 enabled → VTY lines allow SSH from permitted sources → user authenticated (AAA/local) → session logged
Where it usually breaks
source/transport filter → algorithm or host-key trust → authentication → authorization/privilege → audit/recovery
SSH · technical reference
| Stage | What it proves |
|---|---|
| TCP open | Transport path reaches SSH listener |
| SSH handshake | Encrypted protocol established |
| Authentication | User identity accepted |
| Authorization | Intended privilege/actions allowed |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=746