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