From: Alex Dehnert Date: Mon, 12 Mar 2012 18:37:13 +0000 (-0400) Subject: sshroot: minor cleanup, feature, and bugfixes X-Git-Url: https://www.dehnerts.com/gitweb/?p=user%2Falex%2Fsoftware%2Fmy-snippets.git;a=commitdiff_plain;h=83073675460738030c42ad0b9984dd68b63a2817 sshroot: minor cleanup, feature, and bugfixes * delete some kerberos-related lines * don't default to root for ssh'ing * set an environment variable to indicate running under sshroot * allowing passing arguments to the shell subcommand * display the command being run --- diff --git a/sshroot b/sshroot index 97ae2ea..5c41dfa 100755 --- a/sshroot +++ b/sshroot @@ -1,6 +1,4 @@ #!/bin/bash -export KRB5CCNAME=/tmp/krb5cc_$(id -u).root -export KRBTKFILE=/dev/null # lifetime, in minutes lifetime=15 @@ -14,6 +12,7 @@ function with-keys { unset SSH_AUTH_SOCK SSH_AGENT_PID eval $(keychain --timeout $lifetime --eval --host "$hostopt-root" $keys) + export SSHROOT=1 exec "$@" } @@ -21,6 +20,8 @@ function with-agent { unset SSH_AUTH_SOCK SSH_AGENT_PID eval $(keychain --timeout $lifetime --eval --host "$hostopt-root") + export SSHROOT=1 + echo with-agent: Running: "$@" exec "$@" } @@ -43,10 +44,11 @@ case "$command" in with-agent ssh-add -D ;; shell) - with-keys $SHELL + with-keys "$SHELL" "$@" ;; ssh) - with-keys ssh -l root "$@" + #with-keys ssh -l root "$@" + with-keys ssh "$@" ;; *) if [ -z "$command" ]; then