fix for re-adoption

This commit is contained in:
Paolo Asperti 2020-03-07 22:33:08 +01:00
parent 294295fd41
commit 7fadae6fe6
Signed by: paspo
GPG Key ID: 06D46905D19D5182
2 changed files with 3 additions and 1 deletions

View File

@ -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"

1
root/usr/bin/client-shell Normal file → Executable file
View File

@ -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}