How do I get root access to my Google VM instance, and also how can I log into my VM Instance from my PC with a SSH client such as putty?
I would also like to add that I have tried to do sudo for things that need root access to do those things, such as yum or wget. But it does not allow me to do sudo, it asks me for the root password but I do not know how, or where I would be able to get the root password.
How do I use
sudo
to execute commands as root?(splitting this off from the other answer since there are multiple questions within this post)
Once you connect to your GCE VM using PuTTY or
gcloud compute instances ssh
or even clicking on the "SSH" button on the Developers Console next to the instance, you should be able to use thesudo
command. Note that you shouldn't be using thesu
command to become root, just run:and it should not prompt you for a password.
If you want to get a root shell to run several commands as root and you want to avoid prefixing all commands with
sudo
, run:If you're still having issues, please post a new question with the exact command you're running and the output that you see.