7
votes

My gmail account I used to create my google cloud instance is [email protected].

When I tried to connect to instance with WinSCP using "johnsmith" it failed, but it worked with "JOHN.SMITH"? Where can I find out my exact username for google cloud instance?

UPDATE. I tried web-based SSH and typed whoami, it returned "johnsmith". "john.smith" is my windows local username. It is all very confusing.

ANOTHER UPDATE: My google cloud instance is Ubuntu 16.04 and I am connecting from Windows 7 local machine

P.S. I made up the name, but preserved format for this question.

P.S.S SO does not let me post because I don't meet their standard. Here is some bogus code to meet the standard:

print("Hello, World!")
4

4 Answers

8
votes

Just to clarify, I presume you are trying to connect to a Compute Engine Windows Instance in your Google Cloud Platform project, is that correct?

In order to confirm the username of this instance I would recommend following these instructions:

1) Login to Google Cloud Platform Console at this link https://console.cloud.google.com/

2) In the Console main menu (the three horizontal stripes in the top left corner) navigate to 'Compute Engine' and then click on 'VM instances'.

3) You should now be able to see the name of your VM instance- click on it.

4) You will now be in the "VM instance details" screen.

Windows

5) If you now click on "Set Windows Password" a new pane will open that contains your username to login to the instance.

6) If you now press "Set" in the same window, you will receive your Windows password (copy or make note of this).

By using the username and password you retrieved in step 5 and 6 you will be able to access the instance.

You now also have the option of pressing "RDP" in the "VM instance details" page to gain access to your instance via RDP and change your username/password to something more memorable once you have access to the operating system.

Linux

Alternatively, if you are trying to disover the username of a Linux VM Instance, you can confirm this by accessing the machine via SSH from the Console. You will then be able to set the password of the machine.

To SSH into the machine, follow the same first 4 steps in the above instructions, then:

  • Click on "SSH". A new terminal window will open and you will gain access the machine.
  • You will be able to see your username in the shell, or alternatively you can type whoami in the shell and after pressing enter it will print out your username.
  • To set a password for the machine, type sudo passwd then press return. You will then be prompted to enter a new password.
5
votes

Under Cloud Shell Session:

gcloud compute os-login describe-profile

You will see your username.

1
votes

In GCP, I created Ubuntu 18.04 disk/instance (and created a discourse forum in it). I found that when we create a new instance, there is a bar/panel on the right side of the screen, which showed our credentials to login into that instance/website. But I found no way to invoke that details screen again (I can remember that it listed all the software components went into my disk/instance installation).

Anyway, I remembered the username was 'user', but didn't keep record of the auto generated long alphanumeric password. But at last, found the same passsword, when I clicked on the instance name and without clicking on any further, where custom data details start, first line showed the password, labelled: Bitnami-base-password. If its still not clear where to find the pw, check out the SS

1
votes

Using google cloud SDK shell, type the following command:

gcloud compute ssh --project PROJECT_ID --zone ZONE VM_NAME

Replace the following:

PROJECT_ID: the ID of the project that contains the instance
ZONE: the name of the zone in which the instance is located
VM_NAME: the name of the instance

https://cloud.google.com/compute/docs/instances/connecting-to-instance