Key Management

This section details the primary CLI commands used to generate, inspect, modify, and delete your SSH identities within the SKM ecosystem.

skm create

The create command delegates generation to your system's ssh-keygen binary while ensuring the resulting keys are safely stored in a new SKM alias directory.

Usage:

skm create <alias> [options]

Options:

  • -t <type>: Defines the cryptographic algorithm. Supported values are rsa and ed25519. If omitted, it defaults to rsa.
  • -b <bits>: Defines the key size in bits. Only applies to types that support variable bit sizes (like rsa). For RSA, 4096 is strongly recommended.
  • -C <comment>: Adds an identifiable comment (usually an email) to the public key file. This is highly recommended for identifying keys later via skm ls.

Real-World Examples:

Creating a highly secure ED25519 key for GitHub:

skm create github-personal -t ed25519 -C "[email protected]"

Creating a legacy 4096-bit RSA key for an older enterprise server:

skm create legacy-server -t rsa -b 4096 -C "[email protected]"

Edge Cases: If the alias directory already exists, SKM will block the creation to prevent accidental overwrites. You must delete or rename the existing alias first.


skm ls (or skm l)

Lists all SSH key profiles currently stored inside the SKM vault (~/.skm).

Usage:

skm ls

Output Explanation: The command reads the public key files across all alias directories and formats the output alphabetically.

  • The active profile (the one currently symlinked into ~/.ssh) is prefixed with a green ->.
  • It extracts and displays the key type (e.g., ssh-rsa or ssh-ed25519).
  • It extracts and displays the comment attached to the public key.

skm use (or skm u)

Sets a specific alias as the active system default. This is the command you will use most often.

Usage (Direct):

skm use <alias>

Partial Matching: SKM implements a smart partial-matching algorithm. If you type skm use gi, and github is the only alias containing "gi", SKM will automatically select github. If multiple aliases match, or none match, it will throw an error.

Usage (Interactive): If you simply type skm use with no arguments, SKM launches a prompt UI. You can use your keyboard arrows to scroll through available aliases and press Enter to select one. This is excellent for users who maintain dozens of keys.


skm display (or skm dp)

A major pain point in SSH key management is constantly cat-ing public keys to copy-paste them into web interfaces like GitHub, GitLab, or AWS EC2 setups. skm display streamlines this.

Usage:

# Display the public key of the CURRENTLY active alias
skm display

# Display the public key of a SPECIFIC alias
skm display prod-server

Pro-Tip (macOS / Linux): Pipe this command directly into your clipboard for maximum efficiency:

  • macOS: skm display prod-server | pbcopy
  • Linux (xclip): skm display prod-server | xclip -selection clipboard

skm rename (or skm rn)

Changes the name of an existing alias directory. This is useful if your naming conventions change or a project gets rebranded.

Usage:

skm rename <current_alias> <new_alias>

Example:

skm rename test-env staging-env
Note: If the alias you are renaming is currently in use, you should run skm use <new_alias> immediately afterward to ensure the symlinks in ~/.ssh reflect the new directory path.


skm delete (or skm d)

Permanently removes an SSH key profile from the SKM vault.

Usage:

skm delete <alias>

Safety Mechanisms:

  • SKM will prompt you for a [y/n] confirmation before performing the deletion.
  • Crucial Detail: If you attempt to delete the key that is currently in use, SKM will wipe the alias folder from ~/.skm AND remove the symlinks from ~/.ssh/. You will be left without an active SSH key until you run skm use again.