Skip to content

sofianbll/sshk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT Version Stars

sshk logo

sshk

SSH Key Manager — create, organize, grant, and revoke SSH keys. Pure Bash + OpenSSH.

🇬🇧 English · 🇫🇷 Français


Explore the docs · Report Bug · Request Feature

Table of Contents
  1. Features
  2. Built With
  3. Quick Start
  4. Usage
  5. How It Works
  6. Configuration
  7. Server Setup
  8. Project Structure
  9. Contributing
  10. License

Features

(back to top)

  • One identity per purpose — each SSH key lives in its own namespace under ~/.ssh/keys/
  • Manage outgoing identitiescreate, list, show, copy, delete with one command per action
  • Manage incoming accessgrant and revoke who can connect to your machines
  • Zero dependencies — pure Bash, only needs OpenSSH (standard on macOS and Linux)
  • All key types supported — ed25519 (recommended), RSA 4096, and any type OpenSSH supports

Built With

(back to top)

  • Bash — scripting language
  • OpenSSH — key generation, fingerprinting, and transport
  • Git — version control

Quick Start

(back to top)

curl -fsSL https://raw.githubusercontent.com/Sofian-bll/sshk/main/install.sh | bash

Make sure ~/.local/bin is in your PATH, then:

sshk create       # Interactive wizard to create a new SSH key
sshk list         # List all identities and authorized accesses
sshk copy github  # Copy a public key to clipboard
sshk grant vela   # Push a key to a remote server

Usage

(back to top)

$ sshk

  🔑  sshk — SSH Key Manager

  Usage: sshk <command> [options]

  Outgoing Identities
  ──────────────────────────────────────────────────
  create          Interactive creation wizard
  list            List everything (identities + access)
  list --keys     My identities only
  list --auth     Incoming access only
  show <name>     Identity details
  copy <name>     Copy public key
  delete <name>   Delete an identity

  Incoming Access
  ──────────────────────────────────────────────────
  grant <name>    Authorize a remote machine
  revoke <name>   Revoke access

Create a key

$ sshk create

  › Name      : github
  › Type      [1=ed25519, 2=rsa4096] [1] :
  › Comment   [git@github] :
  › HostName  (leave empty if sshk doesn't contact this machine) :

  Name        : github
  Type        : ed25519
  File        : ~/.ssh/keys/github/id_ed25519

  Create? [Y/n]

  ✅ Key created.
  ✅ Created: ~/.ssh/config.d/github.conf

List all keys

$ sshk list

  NAME         TYPE    FINGERPRINT           CREATED
  ──────────────────────────────────────────────────
  github       ed25519 SHA256:nsUE...        2026-03-03
  vela         ed25519 SHA256:s7N3...        2026-06-01
  void         ed25519 SHA256:gszk...        2026-06-01

Show key details

$ sshk show vela

  🔑  vela
  Type        : ed25519
  Fingerprint : SHA256:s7N3Um...
  Comment     : sofian@vela
  Created     : 2026-06-01
  Path        : ~/.ssh/keys/vela/id_ed25519
  Config      : ~/.ssh/config.d/vela.conf
    HostName  : 100.77.184.28

  ssh         : ssh vela
  copy        : sshk copy vela
  delete      : sshk delete vela

Grant access to a server

$ sshk grant void

  ℹ  Copying public key to void (100.115.31.73)...
  ✅ Access granted → macbook authorized on void.

How It Works

(back to top)

sshk organizes SSH keys into three directories under ~/.ssh/:

~/.ssh/
├── keys/                  # Your identities (who you are)
│   ├── github/
│   │   └── id_ed25519
│   └── vela/
│       └── id_ed25519
├── config.d/              # SSH config snippets (ssh <name>)
│   ├── github.conf
│   └── vela.conf
└── authorized_keys.d/     # Who can connect to you
    └── macbook

No more flat ~/.ssh/id_rsa mess. Each identity is namespaced, with a matching config snippet and authorized keys entry.

Configuration

(back to top)

On first run, sshk creates ~/.config/sshk/config with defaults. Edit it to customize:

Option Default Description
SSHK_DEFAULT_TYPE ed25519 Default key type (ed25519 or rsa)
SSHK_DEFAULT_USER $USER Default SSH user for HostName blocks
SSHK_KEYS_DIR ~/.ssh/keys Override keys directory
SSHK_AUTH_DIR ~/.ssh/authorized_keys.d Override authorized keys directory
SSHK_CONFIG_DIR ~/.ssh/config.d Override SSH config snippets directory

Server Setup

(back to top)

On each server, enable authorized_keys.d/ once for grant to work:

mkdir -p ~/.ssh/authorized_keys.d
chmod 700 ~/.ssh/authorized_keys.d
echo 'AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys.d/*' | sudo tee -a /etc/ssh/sshd_config
sudo systemctl restart sshd

Project Structure

(back to top)

sshk/
├── assets/
│   └── logo.svg
├── docs/
│   ├── assets/
│   │   ├── logo.png
│   │   ├── logo-512.png
│   │   └── screenshot.png
│   ├── screenshots/
│   │   ├── sshk-help.png
│   │   ├── sshk-list.png
│   │   └── sshk-show.png
│   └── index.html
├── install.sh
├── LICENSE
├── README.fr.md
├── README.md
└── sshk

Contributing

(back to top)

Contributions are welcome. Here's how:

  1. Fork the repository
  2. Create a branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request
Contributors

License

(back to top)

Distributed under the MIT License. See LICENSE for more information.


Star History Chart

About

SSH Key Manager — create, organize, and grant access. Zero dependencies.

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages