This tool intends to simplify creation, storage, removal and installation of per user per hostname SSH keys.
The only setup required is to add the following to the top of your SSH config ~/.ssh/config
Host *
IdentityFile ~/.ssh/rsa/%h/%r
Rather than having to cd
to the repo and type out ./ssh-manager.sh
it's way easier to add an alias:
alias ssh-manage="/path/to/repo/ssh-manager.sh $@"
To create a new key or replace an existing one use the following:
./ssh-manager.sh create [email protected]
There are a couple of additional parameters create can take:
-p|--password Whether the key should use a pass phrase, it will be prompted for (default: false)
-c|--comment A plain text comment to be included in the key
-b|--bits The bit size of the key (default: 4096)
-t|--type The type of key to create (default: rsa)
To list all the keys we're currently tracking use:
./ssh-manager.sh list
If you want to also see the absolute paths to the keys use --paths
When you list out your keys there are a number of flags that can be assigned against each key:
- [PRV] The private key is present
- [PUB] The public key is present
- [SYM] This key is a symlink to another key
To remove a key you can use:
./ssh-manager.sh remove [email protected]
There are a couple of options for how to remove the key.
The default is to use shred
that will securely delete the key but there are other options, use the -d
or --remove-with
flag with one of the following values:
rm
shred
shred100
Use authorise to copy one of your public keys to the server:
./ssh-manager.sh authorise [email protected]
Get the finger print of a public key by using:
./ssh-manager.sh fingerprint [email protected]
Copies a users public key to the XClipboard so it can be easily pasted somewhere, for example GitHub.
./ssh-manager.sh copy [email protected]