Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
657 B

  1. #!/bin/bash
  2. # This is a hacky effort at showing what SSH agents are running and what keys
  3. # they're holding. It... Sorta works, maybe, including for agents started
  4. # by sshecret, but I am not overwhelmingly confident in it.
  5. # https://github.com/wwalker/ssh-find-agent might be a more robust alternative
  6. # to this.
  7. function sockets {
  8. THE_UID="$(id -u)"
  9. find /tmp -uid "$(id -u)" -type s -name "agent.*" 2>/dev/null
  10. find "/run/user/$THE_UID/" -type s -name "*.sock" -maxdepth 1 2>/dev/null
  11. }
  12. for socket in $(sockets); do
  13. if [ X"$socket" != X ] ; then
  14. export SSH_AUTH_SOCK="$socket"
  15. fi
  16. echo "$SSH_AUTH_SOCK"
  17. ssh-add -l
  18. echo
  19. done