From c346260f6ea3e6bee91f7a02ed78fe3958c56aef Mon Sep 17 00:00:00 2001 From: Alex Dehnert Date: Mon, 12 Mar 2012 14:36:54 -0400 Subject: [PATCH] sshroot: store the timeout in minutes --- sshroot | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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 -- 2.34.1