Skip to content

Instantly share code, notes, and snippets.

@nurse
Created March 7, 2012 19:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nurse/1995260 to your computer and use it in GitHub Desktop.
Save nurse/1995260 to your computer and use it in GitHub Desktop.
scan authorized_keys and show fingerprints
#!/usr/bin/env ruby
require 'tempfile'
IO.foreach(File.join(ENV['HOME'], '.ssh/authorized_keys')).each do |line|
Tempfile.open("key") do |f|
f.puts line
f.flush
r = `ssh-keygen -lf #{f.path}`
r.sub!(f.path, '')
puts r if $? == 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment