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.1.tar.gz (16.4 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.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: authkeyman-1.1.1.tar.gz
  • Upload date:
  • Size: 16.4 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.1.tar.gz
Algorithm Hash digest
SHA256 d51573da0afd754a18b846e42f64f192e4f59f8c1332a8d1acf9c7a9f3b8a7e5
MD5 8ff4be375eab730c0200058d02c58e35
BLAKE2b-256 0ffafd689900595c14cb6322604e1496d6aae63443cab366648ba3eb2dbb7080

See more details on using hashes here.

File details

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

File metadata

  • Download URL: authkeyman-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78d65d771d1c75de0b54529366fb89113bd409964b2dd481f011133bf651b1f9
MD5 bc03252731c7327be1452e1542b2402a
BLAKE2b-256 ac2dd59ba34041e49883262d28f020d0a5be8eba3d9c219bc51c4f528db0260b

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