Being a linux guy at heart, I normally use the bash environment, each time I logged in to a different server I needed to setup a completely new environment for bash. here is my original from 2008 ;)
At the top of your .bashrc script add this:
VERSION="1.1.4" VDATE="13/03/2008"
case $- in i) echo "Simon's BASH Login Scripts -- Version $VERSION ($VDATE)" ;; esac
Each time you change something make sure you change the version and the date..
in your ~/bin directory create a bash script called profileupdate
$ cat profileupdate
acct_list="$HOME/etc/accounts"
copy_files='/home/quantrill/.vim/colors/desert256.vim .vimrc .bashrc '
cd ~ do_account() { # $1 contains string "user@host" echo " $1 "
# Create ~/.ssh (if necessary), copy authorized_keys file ssh -T "$1" \ 'umask 077; mkdir -p ~/.ssh; cat > ~/.ssh/authorized_keys2' \ < ~/.ssh/authorized_keys2 || { echo "Failed to create authorized_keys2 file on $1!" >&2 return 1 } # Now, copy other files over scp $copy_files "$1:~/" || { echo "Failed to copy files to $1!" >&2 return 1 } }
for account in cat "$acct_list"
; do
if [ -z "$" ] ; then
# No arguments specified, so do every host
do_account $account
else
for arg ; do
if [ "$arg" = "${account#@}" ] ; then
# Host was specified on command line
do_account $account
fi
done
fi
done
Next create a file in ~/etc called accounts The format of this file is @
quantrill@servername0 quantrill@servername1 quantrill@servername2 quantrill@servername3
You need to make sure that you have added you ssh key to all of these accounts
$ ssh-copy-id @
You will have to give your password
make sure you can login with no password issue ssh @ you should login with your key only.
If this is a success then you are almost there.
run ~/bin/profileupdate
quantrill@pa2sq:~/bin
$ ./profileupdate
quantrill@servername1 ssh: connect to host servername1 port 22: No route to host Failed to create authorized_keys2 file on quantrill@servername1!
quantrill@servername2 desert256.vim 100% 10KB 10.2KB/s 00:00 .vimrc 100% 23KB 23.4KB/s 00:00 .bashrc 100% 2984 2.9KB/s 00:00
here servername1 failed check ssh keys and if you can connect servername2 was a success.
For any feedback or corrections, please write in to: Simon Quantrill