diff --git a/root/etc/e-smith/events/actions/client-adopt b/root/etc/e-smith/events/actions/client-adopt index e4f90b1..0cd1764 100644 --- a/root/etc/e-smith/events/actions/client-adopt +++ b/root/etc/e-smith/events/actions/client-adopt @@ -17,6 +17,8 @@ ping -c1 "$HOST" >/dev/null || ( exit 1 ) +ssh-keygen -R "${HOST}" + sshpass -p "${PASS}" ssh -t -o StrictHostKeyChecking=no "${USER}@${HOST}" "whoami" || ( echo "Can't login to $HOST as $USER" exit 1 @@ -35,7 +37,6 @@ if [[ "$AMIROOT" = "" ]]; then fi PUB=$(db configuration getprop client-manager ManagementKeyFile) -ssh-keygen -R "${HOST}" cat $PUB | \ sshpass -p "${PASS}" ssh -t -o StrictHostKeyChecking=no "${USER}@${HOST}" "echo '${PASS}' | sudo -S mkdir /root/.ssh >/dev/null ; sudo tee -a /root/.ssh/authorized_keys" diff --git a/root/usr/bin/client-shell b/root/usr/bin/client-shell old mode 100644 new mode 100755 index b493d8b..6f8e27a --- a/root/usr/bin/client-shell +++ b/root/usr/bin/client-shell @@ -13,4 +13,5 @@ if [ "$USER" = "" ] ; then exit 1 fi +/usr/bin/sudo -u amgmt ssh-keygen -R "${1}" /usr/bin/sudo -u amgmt /usr/bin/ssh -o StrictHostKeyChecking=no ${USER}\@${1} ${@:2}