BuildTheNet

Opening your workspace

Your learning content and tools are loading.

SSH and Device Hardening

show crypto key mypubkey rsa

Shows the RSA key pairs the device has generated, which SSH needs before it can start.

Written by a working field network engineer · CCNA, Security+, CySA+

Shows the device’s own RSA key pairs. SSH cannot start without one, and the key name tells you which hostname and domain name it was generated under.

Example output

R1#show crypto key mypubkey rsa
% Key pair was generated at: 09:02:17 UTC Nov 10 2026
Key name: R1.lab.local
Key type: RSA KEYS
 Storage Device: not specified
 Usage: General Purpose Key
 Key is not exportable.
 Key Data:
  30820122 300D0609 2A864886 F70D0101 01050003 82010F00 3082010A 02820101
  00C4A1F3 9B27E0D4 51C8A0E2 7F3B9D16 82E5C0A4 1D7B6F93 E2C84A05 B9D1E637

Reference output: hand-written in standard Cisco IOS format for this example network, not captured from a device. Key data shortened: a 2048-bit key prints about nine lines.

Useful variants

What each column or field means

FieldMeaning
Key namehostname.domain-name at the time the key was generated.
UsageGeneral Purpose Key unless you generated separate signing and encryption keys.
Key is not exportableThe default; the private key cannot be copied off the device.
Key DataThe public key in hexadecimal. Clients cache it to detect a changed device.

When it doesn’t look right

“% Please define a domain-name first.” when generating the key.

Configure ip domain-name <name> (and a hostname other than the default) before crypto key generate rsa.

Clients warn that the host key changed.

The key was regenerated (or the hostname or domain changed and a new key was made). Confirm the change was yours before accepting it.

Related commands

Try it yourself

Learn it in the CCNA path

Topic

SSH and Device Hardening — Replace Telnet with SSH: domain name, RSA keys, local users, VTY transport and login rules, and how to verify each one.

All 57 commands