diff options
-rwxr-xr-x | bin/ssh-list-authorized-keys | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ssh-list-authorized-keys b/bin/ssh-list-authorized-keys index bb153e1..6a03c8d 100755 --- a/bin/ssh-list-authorized-keys +++ b/bin/ssh-list-authorized-keys @@ -18,10 +18,13 @@ end users = all_users.find_all{|u| usernames.include?(u["username"]) or not ((u["groups"]||[]) & groupnames).empty?} +# Buffer the output to avoid EPIPE when the reader hangs up early +output="" users.each do |user| if user["ssh_keys"] user["ssh_keys"].each do |addr,key| - puts "#{key} #{user["fullname"]} (#{user["username"]}) <#{addr}>" + output+="#{key} #{user["fullname"]} (#{user["username"]}) <#{addr}>\n" end end end +print output |