authorized_keys file keeps getting deleted

1,178 views
Skip to first unread message

Anique Tahir

unread,
Nov 22, 2017, 9:06:02 AM11/22/17
to gce-discussion
I'm experiencing a strange issue. The ~/.ssh/authorized_keys file keeps getting deleted for all my instances. This is horrible since I need this file to start my cluster. I've never had this problem on AWS

Taher (Cloud Platform Support)

unread,
Nov 22, 2017, 4:28:52 PM11/22/17
to gce-discussion

Can you confirm whether the file itself is being deleted or the ssh keys inside the file get removed?


If the file itself is being deleted, you can check your startup script which might help you to find the reason behind it.


On the other hand, the file  ~/.ssh/authorized_keys is updated with every modification in SSH key metadata values. You can refer to this article for adding and removing SSH keys. Also, you can use the add-metadata command in Gcloud as another option.


If you suspect that the SSH keys are being deleted in your project, kindly provide the content of /var/log/syslog file to take a closer look at it.

Max Illfelder

unread,
Dec 6, 2017, 7:59:30 PM12/6/17
to gce-discussion
Hi Anique,

If you are using a google provided image, and are adding keys to metadata, you should take a look at our documentation for the accounts daemon: https://github.com/GoogleCloudPlatform/compute-image-packages#accounts

If you add an SSH key for a user to metadata, the accounts daemon considers that user managed by the account daemon. The authorized keys file for the user is deleted when all SSH keys for the user are removed from metadata.
Reply all
Reply to author
Forward
0 new messages