Get root password for Google Cloud Engine VM

2020-02-07 17:51发布

问题:

I just finished installing cPanel in a CentOS VM in Google Cloud Engine and cPanel said the default username is root and the default password is the server's root password.

2016-01-26 12:02:52  958 ( INFO): 3. Enter the word root in the Username text box
2016-01-26 12:02:52  958 ( INFO): 
2016-01-26 12:02:52  958 ( INFO): 4. Enter your root password in the Password text box
2016-01-26 12:02:52  958 ( INFO): 
2016-01-26 12:02:52  958 ( INFO): 5. Click the Login button

How do I get the server's root password?

回答1:

Figured it out. The VM's in cloud engine don't come with a root password setup by default so you'll first need to change the password using

sudo passwd

If you do everything correctly, it should do something like this:

user@server[~]# sudo passwd
Changing password for user root.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.


回答2:

This work at least in the Debian Jessie image hosted by Google:

The way to to enable you to su as root after autentificating with your Google Computer Engine User in the the local environment is pretty straight forward, in fact, involves just one command to enable it and another to use it:

$ **sudo passwd**
Enter the new UNIX password:
Retype the new UNIX password:
passwd: password updated successfully

After executing the previous command and once logged with your Google Computing Engine Use you will be able to switch to root by entering:

$ **su**
Password: <your newly created root password>
root@intance:/#

As we say in economics “caveat emptor” or buyer be aware: Using the root user is far from a best practice in systems administration. Using it user directly can be the cause a lot of trouble, from wiping everything in your drives and boot disks without a hiccup to many other nasty stuff that would be laborious to backtrack, troubleshoot and rebuilt. On the other hand I have never met a SysAdmin that doesn’t think he knows better and root more than they use their own use, that’s until the shit hit the fan. Remember humans are programmed in such a way that given enough time at one at some point or another are going to press enter without taking into account that they has escalated to root and that will great source of pain, regret and extra work. SO USE SPARSELY AND WITH EXTREME CARE.

Gavin said the boring stuff: Have fun, live on the edge, life is short, you only get to live it once, the more you break the more you learn.



回答3:

I had the same problem. Even after updating the password using sudo passwd it was not working. I had to give "multiple" roles for my user through IAM & Admin Refer Screen Shot on IAM & Admin screen of google cloud

After that i restarted the VM. Then again changed the password and then it worked.

user1@sap-hanaexpress-public-1-vm:~> sudo passwd
New password: 
Retype new password: 
passwd: password updated successfully
user1@sap-hanaexpress-public-1-vm:~> su
Password: 
sap-hanaexpress-public-1-vm:/home/user1 # whoami
root
sap-hanaexpress-public-1-vm:/home/user1 #