login about faq

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



asked Jun 15 '10 at 15:47

Rich%20Gegg's gravatar image

Rich Gegg

edited Jun 15 '10 at 15:58

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%20Laurikari's gravatar image

Ville Laurikari

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Jun 15 '10 at 15:47

Seen: 3,499 times

Last updated: Apr 01 '11 at 15:22

All user contributed content licensed under the cc-by-sa license.
Powered by OSQA.