mass exporting keys via script

Hey FreeBSD

I have a little server farm of CentOS based virtual machines hosted on Xen. I have a reasonably secure environment behind a decent firewall setup between the switch and the router so I don't mind doing this and would like the kind of mobility this would provide on my network. The source host is FreeBSD and all the destination hosts are CentOS 5.5i

I wrote a little bash script that should accomplish this:

Code:
#!/bin/sh
HOSTS="sum1 virt1 virt2 virt3 virt4 virt5 virt6 virt7 virt8 virt9 virt10"
for i in $HOSTS; do
/usr/local/bin/rsync -avz  /home/bluethundr/.ssh/  $i:/home/bluethundr/.ssh
done

But for some reason after rsyncing this directory to all those hosts I am not able to log in as if I were able to tediously go through the motions of scp, cat, etc on each one.

I was wondering if someone could shed a little light here?
 
To be petulant: that is not a bash script (or it would call #!/usr/local/bin/bash). On FreeBSD, sh != bash.
 
Other than that: are the resulting permissions ok? Are the ssh keys '-r-------' and owned by the user logging in? I'm not sure whether sshd needs to be restarted when key files are changed/updated during an active session or not.
 
sshd seems to check these things when you first enter the username when logging in.
If you change the keys after entering the username, you need to start a new connection.
sshd itself doesn't have to be restarted.
 
bash script success

Hey dd.. sorry for the long delay in getting back to you. busy with work, yadda yadda.

but long story short i was able to get this to work. I wrote another script that rm'd the key directories across the network.

Here's the working version of the script:
Code:
#!/bin/sh
HOSTS="sum1 sum2 virt1 virt2 virt3 virt4 virt5 virt6 virt7 virt8 virt9 virt10 virt11 virt12"
for i in $HOSTS; do
echo " " 
echo "Transferring bash environtment to host $i"
/usr/local/bin/rsync -avz  /root/.bash* /root/.env  $i:/root/
sleep 5
echo "Transfer motd"
rsync -avz /etc/motd $i:/etc 
echo "MOTD transferred to host $i"
done
Thanks again!
 
Back
Top