fix for re-adoption
This commit is contained in:
parent
294295fd41
commit
7fadae6fe6
@ -17,6 +17,8 @@ ping -c1 "$HOST" >/dev/null || (
|
|||||||
exit 1
|
exit 1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ssh-keygen -R "${HOST}"
|
||||||
|
|
||||||
sshpass -p "${PASS}" ssh -t -o StrictHostKeyChecking=no "${USER}@${HOST}" "whoami" || (
|
sshpass -p "${PASS}" ssh -t -o StrictHostKeyChecking=no "${USER}@${HOST}" "whoami" || (
|
||||||
echo "Can't login to $HOST as $USER"
|
echo "Can't login to $HOST as $USER"
|
||||||
exit 1
|
exit 1
|
||||||
@ -35,7 +37,6 @@ if [[ "$AMIROOT" = "" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
PUB=$(db configuration getprop client-manager ManagementKeyFile)
|
PUB=$(db configuration getprop client-manager ManagementKeyFile)
|
||||||
ssh-keygen -R "${HOST}"
|
|
||||||
cat $PUB | \
|
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"
|
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
1
root/usr/bin/client-shell
Normal file → Executable file
@ -13,4 +13,5 @@ if [ "$USER" = "" ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
/usr/bin/sudo -u amgmt ssh-keygen -R "${1}"
|
||||||
/usr/bin/sudo -u amgmt /usr/bin/ssh -o StrictHostKeyChecking=no ${USER}\@${1} ${@:2}
|
/usr/bin/sudo -u amgmt /usr/bin/ssh -o StrictHostKeyChecking=no ${USER}\@${1} ${@:2}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user