projects
/
user
/
alex
/
software
/
my-snippets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a4af411
)
Better sshroot script
author
Alex Dehnert
<adehnert@mit.edu>
Fri, 25 Jun 2010 07:48:12 +0000
(
03:48
-0400)
committer
Alex Dehnert
<adehnert@mit.edu>
Fri, 25 Jun 2010 07:48:12 +0000
(
03:48
-0400)
Makefile
patch
|
blob
|
history
sshroot
patch
|
blob
|
history
diff --git
a/Makefile
b/Makefile
index 60ecdcb85c93db78dbfeacbacc7de889fb1ea734..1aab0b7752a97e361030168c59843848cc217e88 100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-1,6
+1,6
@@
archdir=/mit/$(ATHENA_USER)/arch/
common=$(archdir)/common/
archdir=/mit/$(ATHENA_USER)/arch/
common=$(archdir)/common/
-scripts=bores-me card-access grep-owners ldapfinger list-members list-of-lists-updater lists-lint rt-set rt-resolve check-host update-officers make-zcrypt-key get-emails mail-merge
+scripts=bores-me card-access grep-owners ldapfinger list-members list-of-lists-updater lists-lint rt-set rt-resolve check-host update-officers make-zcrypt-key get-emails mail-merge
sshroot
arches=i386_deb31 i386_deb40 i386_deb50 i386_rhel4
all : install
arches=i386_deb31 i386_deb40 i386_deb50 i386_rhel4
all : install
diff --git
a/sshroot
b/sshroot
index 75b1f9861a15d7e621302333c47ded6f4d18987c..bac553444711b88ae85fc6c8b4e9722230c260cf 100755
(executable)
--- a/
sshroot
+++ b/
sshroot
@@
-15,35
+15,42
@@
function with-keys
exec "$@"
}
exec "$@"
}
-case $1 in
+command="$1"
+shift
+
+case "$command" in
init)
init)
- shift;
- unset SSH_AUTH_SOCK SSH_AGENT_PID
- echo exec keychain --host "$hostopt-root" $keys
+ echo "Loading default keys (lifetime $lifetime)..."
+ with-keys ssh-add -t $lifetime "$@" $keys
;;
add)
;;
add)
+ echo "Loading keys (lifetime $lifetime):" "$@"
with-keys ssh-add -t $lifetime "$@"
;;
with-keys ssh-add -t $lifetime "$@"
;;
+ list)
+ with-keys ssh-add -l
+ ;;
destroy)
with-keys ssh-add -D
;;
shell)
destroy)
with-keys ssh-add -D
;;
shell)
-
HOSTNAME="`hostname` (sshroot)"
with-keys $SHELL
+ with-keys $SHELL
;;
ssh)
;;
ssh)
- shift
with-keys ssh -l root "$@"
;;
*)
with-keys ssh -l root "$@"
;;
*)
- if [
$# = 0
]; then
+ if [
-z "$command"
]; then
echo "Usage: $0 init" >&2
echo " $0 add" >&2
echo "Usage: $0 init" >&2
echo " $0 add" >&2
+ echo " $0 list" >&2
echo " $0 destroy" >&2
echo " $0 shell" >&2
echo " $0 ssh [args]" >&2
echo " $0 [cmd]" >&2
else
echo " $0 destroy" >&2
echo " $0 shell" >&2
echo " $0 ssh [args]" >&2
echo " $0 [cmd]" >&2
else
- with-keys "$@"
+ echo Executing: "$command" "$@"
+ with-keys "$command" "$@"
fi
;;
esac
fi
;;
esac