I used to do the remote development via VS code. I created SSH key on my local Windows 10 and added the public key to the VM instance. Everything was fine for a week. But my VS Code suddenly show permission denied today. So I try to find out why in GCP console. Here is what I found but I have no clues what is the cause and how to fix it.
- firewall rules are correct and unchanged.
- unable to connect to VM in GCP console by clicking VM instances list > Connect > SSH. It show "Connection Failed". Clicking "Troubleshoot" button will show VM Status OK and Network status OK but Stuck at loading when checking User permissions.
From here, I think its related to some permission problem, maybe SSH key?
- Then I created a new SSH key pairs on my local Windows 10.
- The new key is then added to the VM. No expiry date is set, just "{KEY} {USER}". However, I still cannot connect SSH via VScode.
- Connect to VM in GCP still fail
- I tried to create a new VM and test with the SSH key pairs. The key is working. I can connect with VS code.
Then I try to "View Log". And found there are many Errors every time a Updating keys for user g3dayseo is logged. Here are some examples.
Title
Updating keys for user g3dayseo.
{
insertId: "27ysnuf4tckja"
jsonPayload: {
localTimestamp: "2023-06-30T00:09:42.8300Z"
message: "Updating keys for user g3dayseo."
}
logName: "projects/beautylnfcom/logs/GCEGuestAgent"
receiveTimestamp: "2023-06-30T00:09:43.842531278Z"
resource: {2}
severity: "INFO"
sourceLocation: {3}
timestamp: "2023-06-30T00:09:42.830084525Z"
}
Title
Invalid ssh key entry - expired key: g3dayseo:ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFKv3f/jQZRbGdQnvL5Swy6f/E4Z84nnwHfgyiorYPu5VS5GF9yOOTe3wFFtGLFQns0qHtzIn2MgsEfQQIml8Vk= google-ssh {"userName":"[email protected]","expireOn":"2023-06-30T00:12:27+0000"}
Content
{
insertId: "1js4l5ne4dso2"
jsonPayload: {
localTimestamp: "2023-06-30T00:12:42.9094Z"
message: "Invalid ssh key entry - expired key: g3dayseo:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCWSRpEt0TN03Jehtu0HEM2pXoJK7+wqZfss/TSbCGqPaZ4y36nZ8d/zyc9Q3cLkTFN9nYlDEwwUnG1UASpKBYox0Q7o/KTBOP0YGzksTPTvBjWaiUlCmZ/jAdj3ATaH5xyyjX89V5BXWAJRG2HxbW/U1r48Uk5Z+OZ8Q82MzYST6FkJbONp2jG9NEIiyg/oEj8iCpAMlh6xcioAlYZSyvAcKR6auCDkOcUTOkTG09/UG/3ZHdY+ZnMiMyGI1rc9fTN36yA7oSMvpKWxvk+caWpUTA4jlovxYIm5EeN9vk5BKK2YGt7cBNynZgA394M/mKAIk/n3rLaAVBitIexwntL google-ssh {"userName":"[email protected]","expireOn":"2023-06-30T00:12:41+0000"}"
}
logName: "projects/beautylnfcom/logs/GCEGuestAgent"
receiveTimestamp: "2023-06-30T00:12:43.919710439Z"
resource: {
labels: {3}
type: "gce_instance"
}
severity: "ERROR"
sourceLocation: {
file: "non_windows_accounts.go"
function: "main.getUserKeys"
line: "199"
}
timestamp: "2023-06-30T00:12:42.909503214Z"
}
I don't know what I can do at the moment. I searched for many articles. Some told us to try on the cloud shell.
gcloud compute ssh --zone "asia-east1-b" "newpostai" --project "beautylnfcom"
Then it asks for password. But as I remember, I didn't set a password before.
Please help. I am quite frustrated. Althought I have backup and I could load it on new instance, I really want to figure out how this happen after a reboot, how to fix it and how to prevent it.
Thank you in advanced to reading this.