0

I am trying to authenticate as sudo in a linux Google Cloud VM. I know there are several similar questions, but none have solved my problem. Here's what I've tried:

  • Setting a password using sudo passwd, as in this answer.
  • Giving myself 'Compute Admin' permissions in IAM, and then running sudo passwd, as in this answer.
  • Running sudo invoke-rc.d procps start, as in this answer.
  • Running sudo passwd in the cloud shell terminal, successfully setting a password there, restarting and SSHing into my VM, and then trying to either set a password or authenticate as sudo

For all these, I am connecting using GCloud's SSH in browser. Every time, I just get prompted for the sudo password, and nothing I type in works. In case it matters, my google cloud account is associated with an institutional (university) google account.

I'm at a loss here. Any suggestions are much appreciated!

sdg
  • 165
  • 8
  • A simple workaround I should've thought of before posting: I just added my personal gmail to the project and use that when I need to do something as sudo. It appears that this problem is related to using google cloud associated with my institutional account--not sure if this is specific to my institution. I would still be interested to know of any alternative solutions. – sdg Feb 10 '23 at 01:53

1 Answers1

0

By default password based authentication and root login is disabled in GCP vms, so if you are trying to do password based ssh first you need to enable it follow this documentation for enabling password based access but it is not suggested to enable password based authentication as it makes your environment vulnerable. As you are saying your terminal is getting stuck have you checked the resource utilisations of cpu and memory.

  • Sorry for the delay @Kranthiveer Dontineni. This did not help, because I am trying to authenticate as sudo once logged into the VM, not trying to SSH using a password. – sdg Feb 10 '23 at 01:49
  • @sdg can you give the command you are trying to use..? – Kranthiveer Dontineni Feb 13 '23 at 04:41
  • @Kravintheer, it's any command that you can prefix with `sudo`. – sdg Feb 13 '23 at 18:12
  • @sdg Now I got it, can you confirm whether this instance is created by you or some system admin department. If it was created by your system admin you can ask them to grant root access as it seems they have restricted the root access to you. you can also get root access by entering initramfs or grub rescue mode and changing the access rights to your user but it's not recommended as your institution has blocked the access. – Kranthiveer Dontineni Feb 14 '23 at 05:56
  • Hi @Kranthiveer, the VM was created by me; the project was created by a collaborator and is not under our organizational umbrella. In any case I was able to work in `sudo` mode by adding my personal gmail account and using that--see my comment on the original question above. PS-apologies I misspelled your name in my previous comment. – sdg Feb 15 '23 at 01:38