Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • thanks. I want to operate on the authorised_keys file, though, not individual .pub files Commented Apr 17, 2014 at 10:54
  • Ok, check if edited answer is the one liner you have been looking for. Commented Apr 17, 2014 at 11:04
  • thanks. please format your answer with any code, commands etc using the '{}' icon in the text editor Commented Apr 17, 2014 at 11:21
  • That doesn't work, -f expects a file name (and that file has to be a regular file as ssh-keygen opens and reads the file several times) Commented Apr 17, 2014 at 13:22
  • Use instead: while read line; do echo "$line" > key.pub; ssh-keygen -lf key.pub ; rm key.pub; done < <(cat authorised_keys) Commented Apr 17, 2014 at 13:44