I need to build a shell script or something to allow me to tag each key to an owner before appending them to the authorized_keys2, as well as a script/tool to allow me to remove them once I have appended them. A report would also be nice.
Has anyone done this, or is there a uility or 3rd party tool to help? I have tried manually editing the key with varying success. I am looking for a automated process to run or use.
I currently use:
ssh-keygen -X -f xxxx_identity.pub >> authorized_keys2
The authorized_keys file format has space for comments for each key. Each key line consists of the following space-separated fiels: - options - key type - base64-encoded key - comment
I'm imagining a fairly simple shell script which adds the user name in the comment field. It can then be used to remove the line for a specific user when requested. But I'm not aware of a ready-made tool for this.
As a sidenote, the "authorized_keys2" file name is deprecated since 2001, you can use "authorized_keys" instead. The same goes for the -X command line flag, the modern flag for that is probably -i.
answered Sep 03 '10 at 05:56
Ville Laurikari ♦