So I am facing a strange issue with my digital ocean server. Everytime I restart the server manually from the website my .authorizedkeys get reset. It always has a value

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAm8glBB05kyIgRXCs8WuRwV5zLVU0LjzL1eFl70hIj0/raIl1RxCMrm6u7+fLjxEgoaCiuoNrL+gb+9Z6uBPhIdF3Q61WLuNB/nQ83S3o3d6gW9urkYU3/jKO1y7RZ+E/3u5GNrFsdMl4xaLatjcj7KSU6WJo4c90OSu0RhzZLS2jWKOLiWF3JSwoKTXouAfcDebhyt97D/HF/mZsIIG9wZVVZVoqFpm/RSZvsYvDdICy8hk3osVXW5rSw0vpB9uWBSQBfiJ5/eKZBeKSkJE8s3T75/NFrrr0n6A3h7fODsjUTIOYjOcFqAyrzdBG59eo441MaqB4nThGk+007IACZw== root@dedi10243.hostsailor.com

How to find who is doing it?

I am using Ubuntu. And its not from my digital ocean server settings.

  • Please add some more information. What OS are you using exactly, what does the server do, is a management software like Plesk/Odin installed? And so on. – Thorian Apr 24 '16 at 11:43
  • I am using ubuntu. Is it possible to find what all is modifying that file – Geo Paul Apr 24 '16 at 11:48
  • Please update your answer with the asked information. If the file is changed on boot a management software may do this or your hoster made some settings to something like that. – Thorian Apr 24 '16 at 12:05
  • What happens if you reboot the server with the shutdown command instead of shutting it down via the website? – James Youngman Apr 26 '16 at 21:42

It looks like the .authorized_keys file is updated from the data you entered in the DigitalOcean control panel.

See the DigitalOcean documentation article How To Configure SSH Key-Based Authentication on a Linux Server for an explanation.

In the section How to Embed your Public Key when Creating your Server you may find useful information, depending on your configuration.

  • Please give a brief overview what the article says regarding this question rather than just throwing in a link. – Thorian Apr 24 '16 at 13:14
  • 2
    @Thorian I did. That is the first sentence of my answer. – James Youngman Apr 24 '16 at 13:27
  • I checked digital ocean. Its not from there. – Geo Paul Apr 25 '16 at 3:33
  • Due to the issue occurring only after a reboot, there must be some setting that does that. Quick and dirty you could setup a cronjob that replaces the file with another file that contains the correct keys. But if it's not your DigitalOcean setting I don't really know what to look for. Especially as we still don't know the purpose of the system etc. – Thorian Apr 26 '16 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.