Simplified SSH interaction.

This commit is contained in:
Scott Wallace 2016-02-17 10:49:03 +00:00
parent 89d0686a43
commit ab1abfe496
2 changed files with 3 additions and 22 deletions

24
.bashrc
View file

@ -89,28 +89,10 @@ export GOPATH=${HOME}/src/go
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------
# Run an SSH agent, if possible # Run an SSH agent, if possible
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo -n "Initialising new SSH agent... "
ssh-agent 2> /dev/null | sed 's/^echo/#echo/' > "${SSH_ENV}"
pgrep ssh-agent > /dev/null && echo "succeeded" || echo "failed"
chmod 0600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
ssh-add ~/.ssh/scott@wallace.sh
}
# Check if we already have an agent running and sourced # Check if we already have an agent running and sourced
if [ -z "${SSH_AUTH_SOCK}" -a -n "${PS1}" ]; then if [ -z "${SSH_AUTH_SOCK}" ]; then
# Source SSH settings, if applicable eval `ssh-agent -s`
if [ -f "${SSH_ENV}" ]; then ssh-add
. "${SSH_ENV}" > /dev/null
pgrep ssh-agent | grep -E "^${SSH_AGENT_PID}" > /dev/null || {
start_agent
}
else
start_agent
fi
fi fi
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------

View file

@ -44,7 +44,6 @@ function install_osx_software {
mosh mosh
python3 python3
vim vim
homebrew/dupes/openssh
EOF EOF
#------------------------------- #-------------------------------