Score:0

I accidentally set /home/user/.ssh permissions to 755 and I'm locked out of my google cloud bitnami instance SSH

us flag

I'll admit I'm not the most sysadmin savvy person; this is my first time working with google cloud and bitnami so I really do not know what I'm doing.

The problem: I wanted to set the permissions of a project folder to 755 for php related reasons (creating/editing files for accounts on my project) and I did not know that the .ssh folder for the disk was located in the same spot - /home/[myusername]/. I intended to modify /home/[myusername]/[project]/userdata/ but I think I did it two directories up and recursively. Since it's now configured incorrectly, none of my keys work anymore, and even after generating new ones with PuttyGen and setting that up in the Google Cloud instance manager, I still can't connect. I have no obvious way of getting back into the server and fixing the permissions.

The question: Is there some other way for me to access my instance's file system to set the folder's permissions correctly and/or reset ssh? And what permissions should that folder have? I can access the google cloud console but I have no idea where to look. I don't want to start over because I made the further stupid mistake of not saving the project's code onto my local machine or a git repository.

Instance type: Bitnami LAMP 7.4.20-8

John Hanley avatar
cn flag
Use the serial port to correct the permissions on `.ssh` and it contents. https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-using-serial-console
John Hanley avatar
cn flag
The permissions for the folder `.ssh` should be `700` read-write-execute for the owner only. The permissions for `.ssh/authorized_keys` should be `600` read-write for the owner only. The `chmod` command can explain how to make these settings.
loohhoo avatar
us flag
@JohnHanley I followed the steps and I get 'permission denied'. I tried: ```gcloud compute --project "project-name" ssh --zone "us-east4-a" "instance-name"``` (with my details) - which didn't work at first, so I did it again with sudo - and it generated a key pair but still refused to connect. Couldn't get to the next step to set a password.
loohhoo avatar
us flag
Update: I was typing the project "name" and not its actual ID into the console, I'm now in my server instance :') thank you so much
John Hanley avatar
cn flag
Post an answer with the steps you followed that recovered your system. This will help others in the future.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.