Created
July 9, 2011 18:55
-
-
Save mapi/1073843 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#screenでssh-agentを使いまわす | |
function ssh-init { | |
local SSH_AUTH_SOCK_DIR="$HOME/.tmp/ssh-agent" | |
#ここは初めてか? | |
if [ ! -d ${SSH_AUTH_SOCK_DIR} ]; then | |
mkdir -p ${SSH_AUTH_SOCK_DIR} | |
chmod 700 ${SSH_AUTH_SOCK_DIR} | |
fi | |
#ソケット作る | |
AGENT="${SSH_AUTH_SOCK_DIR}/`hostname`" | |
if [ -S "${AGENT}" ]; then | |
export SSH_AUTH_SOCK=${AGENT} | |
elif [ ! -L "${SSH_AUTH_SOCK}" ]; then | |
ln -snf "${SSH_AUTH_SOCK}" ${AGENT} && export SSH_AUTH_SOCK=${AGENT} | |
elif [ ! -S "${SSH_AUTH_SOCK}" ]; then | |
echo "no ssh-agent" | |
exit 1 | |
fi | |
ssh-add ${1} | |
#それkeychainで出来るよ | |
#http://manpages.ubuntu.com/manpages/oneiric/en/man1/keychain.1.html | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment