How to fix SSH key rewrite issue

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
  3. Into this code:
    if [ ! -e $authorized ]
    then
    touch $authorized
    cat $authorized|grep -v "$publickey" > $authorized
    echo "$publickey" >> $authorized
    fi
  4. Save file.
  5. Delete old authorized_keys file located in ~/.ssh/ folder.
  6. Restart your cloud.

Now your SSH keys will not be rewritten.

Was this article helpful?

Need support?

If you need any further help, don't hesitate to send a support request to our support team.