-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Having gotten tired of manually installing my ssh pubkey on boxes I
wondered if
there might be a way to automate the process. This handy little shell script
ssh-wrapper was the result. I save it as ~/bin/pubkey-installer.sh and
alias my
ssh command to this and always get my public key automatically installed
on the
box I log into. I have tried to make is as generic and work just like the
normal ssh as possible. Improvements are welcome.
alias ssh='~/bin/pubkey-installer.sh'
#!/bin/sh -x
# Public key auto-installer script by Tracy Reed <[EMAIL PROTECTED]>
#
# Be sure to fill in your own pubkey unless you want to give me access :)
#
PUBKEY="ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAIEAzs0h49jraOI7W33S1DfXvi9myx0VNxrGIFfY8H15Ry5BNxHhfFCxCBytemBMzpNVWvC9LiDOq767YC8fxEFtscpacvAGtl3aGhBZh789Ji+FYgDcG/O+rsdq5YnZMWIAJz4ne/IwSEFLuQJ+lklxAZEelBaGpuqyp3uV2Tii1B0=
[EMAIL PROTECTED]"
SSH="/usr/bin/ssh"
# Save our destination to ssh to
DESTINATION=$1
# Shift destination off array leaving us only with the commands to run
remotely
shift 1
# Do we want just a shell or do we want to run some commands remotely?
if [ $1 ]; then
COMMAND="$SHELL -c '$@'"
else
COMMAND="$SHELL"
fi
$SSH -tt $DESTINATION "PUBKEY='"$PUBKEY"'; grep '"$PUBKEY"'
~/.ssh/authorized_keys >/dev/null 2>&1 || (echo '"$PUBKEY"' >>
~/.ssh/authorized_keys && echo "Installed public key"); $COMMAND"
- --
Tracy R Reed
http://ultraviolet.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCzQsG9PIYKZYVAq0RAh8GAKCMU3O1tFB+ouzJhQIGKRxKauMeJgCeLGqT
o4unFAqEjRxHE4ZmTLyqf0M=
=rUV6
-----END PGP SIGNATURE-----
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list