Add ssh-agent setup for pass-phrase protection
Gonna be using pass phrase ssh keys...
This commit is contained in:
parent
f31c077790
commit
240bb600f3
2 changed files with 34 additions and 1 deletions
28
scripts/ssh_session
Executable file
28
scripts/ssh_session
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# setup ssh-agent
|
||||
#
|
||||
|
||||
SSH_ENV="$HOME/.ssh/environment"
|
||||
|
||||
function start_agent {
|
||||
echo "Initialising new SSH agent..."
|
||||
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
|
||||
echo succeeded
|
||||
chmod 600 "${SSH_ENV}"
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
/usr/bin/ssh-add;
|
||||
}
|
||||
|
||||
# Source SSH settings, if applicable
|
||||
|
||||
if [ -f "${SSH_ENV}" ]; then
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
|
||||
start_agent;
|
||||
}
|
||||
else
|
||||
start_agent;
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue