diff --git a/ssh.sh b/ssh.sh index 0c7fa62..8d9ef96 100755 --- a/ssh.sh +++ b/ssh.sh @@ -6,7 +6,7 @@ keyname=${1} hostname=${2} -keyfile=$HOME/.ssh/${keyname}_$(date "+%F-%T") +keyfile=$HOME/.ssh/${keyname}-$(date "+%s") #Check to see if user is logged in to lastpass cli #check_login() #{ @@ -27,7 +27,7 @@ sshpassphrase=$(lpass show $keyname --field=Passphrase) #Add the key to ssh-agent expect << EOF - spawn ssh-add $keyfile + spawn ssh-add -t 30 $keyfile expect "Enter passphrase" send "$sshpassphrase\r" expect eof @@ -36,8 +36,5 @@ EOF #SSH to the host ssh $hostname -#remove the key from the ssh-agent -ssh-add -d $keyfile - -#remove the key +#Remove keyfile rm -f $keyfile