Skip to main content

Quickly manage your authorized public SSH keys

Project description

authkeyman

A simple command-line tool to make managing your ~/.ssh/authorized_keys file easier.

Features

  • Add keys to your authorized_keys file.
  • Remove keys from your authorized_keys file by key comment.
  • Add and remove keys from other users when running as root.

Install

If you don't need to manage other users' authorized_keys files, then simply install with pipx:

pipx install authkeyman

Otherwise, install the tool system-wide by running this command:

curl -L https://raw.githubusercontent.com/TacticalLaptopBag/authkeyman/refs/heads/main/curl-install.sh | sudo bash

Uninstall

If you installed with pipx, simply use that to uninstall:

pipx uninstall authkeyman

If you installed using the curl-install.sh script, use this command:

curl -L https://raw.githubusercontent.com/TacticalLaptopBag/authkeyman/refs/heads/main/curl-uninstall.sh | sudo bash

Usage

Add Keys

Add keys to the authorized_keys file:

authkeyman add "ssh-ed25519 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX your-key-name"

Note that the key is wrapped in quotes.

You can also add multiple keys at once by stringing them together:

authkeyman add "ssh-ed25519 ... key1" "ssh-ed25519 ... key2" ...

Remove Keys

Remove keys from the authorized_keys file by using its comment:

authkeyman remove your-key-name

You can remove multiple keys at once:

authkeyman remove key1 key2

You can also use partial comments and authkeyman will prompt you if the matching key is the one you want to remove:

authkeyman remove key-name
No keys found commented with 'key-name', but a similar key was found:
your-key-name

Would you like to use this one instead? (y/N):

If multiple keys match, it will ask you to make a decision:

authkeyman remove key
No keys found commented with 'key', but these similar keys were found:
[0]: key1
[1]: key2

Which one would you like to use instead? (Default 0, make a selection 0-1): 

Running this command with -y will skip the prompt and remove the key. If multiple keys match, it will delete the first key that matches.

List Keys

Lists all key comments in the authorized_keys file:

authkeyman list
Keys in /home/user/.ssh/authorized_keys:
key1
key2

Perform Actions on Other Users

You can run all of these commands on other users when running authkeyman as root and specifying the --user flag:

sudo authkeyman --user user1 add "ssh-ed25519 ... user1s-key"

You can add additional --user flags to specify multiple users:

sudo authkeyman --user user1 --user user2 add "ssh-ed25519 ... users-key"

Note that the --user flags must come directly after authkeyman and cannot come after a subcommand.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

authkeyman-1.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

authkeyman-1.1.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file authkeyman-1.1.0.tar.gz.

File metadata

  • Download URL: authkeyman-1.1.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.7 Linux/6.11.0-29-generic

File hashes

Hashes for authkeyman-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f58921e1477842f6ff9012898f928d0de7097976c5e2debb6aec4bbd282615f5
MD5 20007ae1668d70a110337eebbbdad1f3
BLAKE2b-256 3cdf837979303227cc3329f73d415df03224c8232e91a829441f3d9ea63de28f

See more details on using hashes here.

File details

Details for the file authkeyman-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: authkeyman-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.7 Linux/6.11.0-29-generic

File hashes

Hashes for authkeyman-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cd8aad9bb9464a31d7ada9c160475e7ec9228f713ee12dfa56893cd83904c29
MD5 e38dde7275650717bc56ca70f5ee6872
BLAKE2b-256 9cba556ce1596eaee556a712ff5c841d94c41c14925c5b50535d53cf5bdfb82d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page