Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This is a mashup of two solutions I found to the problem of connecting old screen sessions to the
- # current ssh-agent.
- #
- # I got the find command from: http://www.tolaris.com/2011/07/12/reconnecting-your-ssh-agent-to-a-detached-gnu-screen-session/
- #
- # I got the original ssh-reagent function from: http://sweetjesus26.livejournal.com/16782.html
- # Find a usable agent
- function ssh-reagent () {
- export SSH_AUTH_SOCK=$(find /tmp/ssh-* -user `whoami` -name agent\* -printf '%T@ %p\n' 2>/dev/null | sort -k 1nr | sed 's/^[^ ]* //' | head -n 1)
- if $(ssh-add -l > /dev/null) ; then
- echo Found working SSH Agent:
- ssh-add -l
- return
- fi
- echo Cannot find ssh agent - maybe you should reconnect and forward it?
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement