improve the adding of known_hosts
@@ -251,12 +251,16 @@ if [ ! -e AppScalefile ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
- # Create an SSH key if it does not exist.
+ # Create an SSH key if it does not exist, and allow for local ssh
+ # passwordless operations.
test -e /root/.ssh/id_rsa.pub || ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""
-
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
- ssh-keyscan $PUBLIC_IP $PRIVATE_IP 2> /dev/null >> .ssh/known_hosts
+
+ # Make sure the localhost is known to ssh.
+ ssh-keygen -R $PUBLIC_IP
+ ssh-keygen -R $PRIVATE_IP
+ ssh-keyscan $PUBLIC_IP $PRIVATE_IP 2> /dev/null >> /root/.ssh/known_hosts
# Download sample app.
if [ ! -e ${GUESTBOOK_APP} ]; then
