ssh-agent checker
This commit is contained in:
parent
bc94c36563
commit
ad1755938c
1 changed files with 16 additions and 1 deletions
|
|
@ -1 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Start ssh-agent and add keys in ~/.ssh directory
|
||||
# Should only be used without a desktop manager
|
||||
ENV=/tmp/.agent_env
|
||||
KEYS=$(basename --suffix=.pub -a $HOME/.ssh/*.pub)
|
||||
if [ -z "$SSH_AGENT_PID" ] && [ ! -e "$ENV" ] ; then
|
||||
ssh-agent > $ENV
|
||||
source $ENV
|
||||
for key in $KEYS;
|
||||
do
|
||||
ssh-add ~/.ssh/$key
|
||||
done
|
||||
echo 'Agent started'
|
||||
else
|
||||
source $ENV
|
||||
echo 'Agent started already, good to go'
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue