Added ssh-with-timeout for ssh-agent usage with password-protected keys
This commit is contained in:
@@ -15,5 +15,6 @@ unset SSH_ASKPASS
|
||||
eval "`dircolors -b $DIR_COLORS`"
|
||||
|
||||
export PATH=$PATH:$HOME/.local/bin
|
||||
alias ssh=$HOME/.local/bin/ssh-with-timeout.sh
|
||||
|
||||
#### END MAGIC VALUE: AZSQFRB8
|
||||
|
||||
13
gitconfig
13
gitconfig
@@ -3,7 +3,7 @@
|
||||
name = ENTERME
|
||||
[diff]
|
||||
tool = vimdiff
|
||||
wsErrorHighlight = all
|
||||
wsErrorHighlight = all
|
||||
[difftool]
|
||||
prompt = false
|
||||
[alias]
|
||||
@@ -18,13 +18,8 @@
|
||||
default = simple
|
||||
[core]
|
||||
editor = vim
|
||||
sshCommand = /home/anaber/.local/bin/ssh-with-timeout.sh
|
||||
[pull]
|
||||
ff = only
|
||||
ff = only
|
||||
[http]
|
||||
postBuffer = 524288000
|
||||
sslcainfo = /etc/ssl/certs/ca-certificates.crt
|
||||
[filter "lfs"]
|
||||
clean = git-lfs clean -- %f
|
||||
smudge = git-lfs smudge -- %f
|
||||
process = git-lfs filter-process
|
||||
required = true
|
||||
postBuffer = 524288000
|
||||
|
||||
2
setup.sh
2
setup.sh
@@ -25,7 +25,7 @@ done
|
||||
|
||||
echo "Copying scripts"
|
||||
mkdir -p "${HOME}/.local/bin"
|
||||
script_copy_list=(update-dns.sh gentags)
|
||||
script_copy_list=(update-dns.sh gentags ssh-with-timeout.sh)
|
||||
for script in ${script_copy_list[@]}; do
|
||||
cp -fr "${script}" "${HOME}/.local/bin/${script}"
|
||||
done
|
||||
|
||||
31
ssh-with-timeout.sh
Executable file
31
ssh-with-timeout.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
SSH_ENV="$HOME/.ssh/environment"
|
||||
|
||||
function load_key_file {
|
||||
local key_rsp="$(ssh-add -L 2>&1)"
|
||||
if [[ "${key_rsp}" == *"The agent has no identities"* ]]; then
|
||||
ssh-add /home/anaber/.ssh/id_rsa
|
||||
fi
|
||||
}
|
||||
|
||||
function start_ssh_agent {
|
||||
ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
|
||||
}
|
||||
|
||||
if [ ! -e "${SSH_ENV}" ]; then
|
||||
start_ssh_agent
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
else
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep -q ssh-agent$ || {
|
||||
start_ssh_agent
|
||||
}
|
||||
. "${SSH_ENV}" > /dev/null
|
||||
fi
|
||||
export SSH_AGENT_PID
|
||||
export SSH_AUTH_SOCK
|
||||
|
||||
load_key_file
|
||||
# Pass command line arguments to ssh
|
||||
/usr/bin/ssh $@
|
||||
Reference in New Issue
Block a user