You might have experienced some issues that your SSH keys are being rewritten in your cloud.

To solve the issue, check the instructions bellow:

  1. You have to edit the following file with your favorite editor (vi, nano, etc..) 

/etc/init.d/cloud-set-sshkey

    2. Replace following code: 

if [ ! -e $authorized ]
then
touch $authorized
fi
cat $authorized|grep -v "$publickey" > $authorized
echo "$publickey" >> $authorized

Into this code:

if [ ! -e $authorized ]
then
touch $authorized
cat $authorized|grep -v "$publickey" > $authorized
echo "$publickey" >> $authorized
fi

      3. Save file.
     
      4. Delete old authorized_keys file located in ~/.ssh/ folder.

      5.  Restart your cloud.

Now your SSH keys will not be rewritten.

Did this answer your question?