0

I'm using a VM hosted on G Cloud and a few weeks ago I executed a sudo chown command like: sudo chown -R Username / (not sure on how exactly the command was) to get full access on my VS Studio IDE.

After executing I wasn't able to use the SSH popup on the G Cloud website anymore. Now I want to upload files to my VM and the only way I know is by using the SSH popup.

I still have access via my IDE but I don't know on how to regain access via the SSH popup.

Can I regain access via SSH by giving access? I don't want to execute something which might destroy my last access point so I ask for help before executing anything.

Any help would be greatly appreciated!

Rocket
  • 9
  • @roaima I try to avoid reinstalling the VM. Isn't there a command I can use to give my google account (I know the username) access again? Like sudo chown -R $USER ? I also have access to the logs and all. I'm just unexperienced with Linux. – Rocket Aug 17 '23 at 11:18
  • 3
    Unfortunately you've broken your system. You used sudo which gives you unrestricted administrative rights to the system, so it can't protect you from mistakes. You then changed the ownership of every file on the system, breaking its security capability. As a result you will now not be able to use the system. Restore from your latest backup. – Chris Davies Aug 17 '23 at 11:30

1 Answers1

0

For my specific case, I was able to regain access via the SSH popup by changing my username to the username I used for the chown command. Probably no solution for the long run, but it works for my case.

Rocket
  • 9
  • 1
    In that case you are (a) extremely fortunate, (b) unlikely to have specified / as the starting point for the chown command. Thank you for the update though – Chris Davies Aug 17 '23 at 12:24
  • 2
    if you really changed ownershop on "/" and subdirs: you still probably bricked your system: it probably won't be able to boot next time, and/or may fail in unexpected ways (depending which username you chown'd everything to). There are tedious ways to fix this while you still have sudo access, or you may consider moving its datas (only) to another freshly installed server – Olivier Dulac Aug 17 '23 at 13:10
  • @OlivierDulac Hopefully this project will be done in a month, then I won't need it anymore anyways. But reinstalling the whole VM would take some time I don't have. :) – Rocket Aug 17 '23 at 16:03