From: Alex Dehnert Date: Mon, 12 Mar 2012 18:36:54 +0000 (-0400) Subject: sshroot: store the timeout in minutes X-Git-Url: https://www.dehnerts.com/gitweb/?p=user%2Falex%2Fsoftware%2Fmy-snippets.git;a=commitdiff_plain;h=c346260f6ea3e6bee91f7a02ed78fe3958c56aef sshroot: store the timeout in minutes --- diff --git a/sshroot b/sshroot index 6a0c4b5..97ae2ea 100755 --- a/sshroot +++ b/sshroot @@ -2,7 +2,9 @@ export KRB5CCNAME=/tmp/krb5cc_$(id -u).root export KRBTKFILE=/dev/null -lifetime=900 +# lifetime, in minutes +lifetime=15 + hostopt="" [ -z "$hostopt" ] && hostopt="${HOSTNAME}" [ -z "$hostopt" ] && hostopt=`uname -n 2>/dev/null || echo unknown` @@ -11,14 +13,14 @@ keys=~/.ssh/id_rsa_root function with-keys { unset SSH_AUTH_SOCK SSH_AGENT_PID - eval $(keychain --eval --host "$hostopt-root" $keys) + eval $(keychain --timeout $lifetime --eval --host "$hostopt-root" $keys) exec "$@" } function with-agent { unset SSH_AUTH_SOCK SSH_AGENT_PID - eval $(keychain --eval --host "$hostopt-root") + eval $(keychain --timeout $lifetime --eval --host "$hostopt-root") exec "$@" } @@ -28,11 +30,11 @@ shift case "$command" in init) echo "Loading default keys (lifetime $lifetime)..." - with-agent ssh-add -t $lifetime "$@" $keys + with-agent ssh-add -t ${lifetime}m "$@" $keys ;; add) echo "Loading keys (lifetime $lifetime):" "$@" - with-agent ssh-add -t $lifetime "$@" + with-agent ssh-add -t ${lifetime}m "$@" ;; list) with-agent ssh-add -l