Connect to an instance as a root user in GCP

0 votes
I have configured a Linux VM instance to allow SSH as the root user and configure an SSH key for the root user on that instance. How can I connect to it as the root user?
Sep 24, 2019 in GCP by anonymous
• 19,610 points
5,486 views

1 answer to this question.

0 votes

If you configured an instance to allow SSH as the root user and configure an SSH key for the root user on that instance, you can connect as root using the gcloud compute ssh command with root@ specified before the instance name:

gcloud compute ssh --project [PROJECT_ID] --zone [ZONE] root@[INSTANCE_NAME]

where:

  • [PROJECT_ID] is the ID of the project that contains the instance.
  • [ZONE] is the name of the zone in which the instance is located.
  • [INSTANCE_NAME] is the name of the instance.
answered Sep 24, 2019 by Sirajul
• 59,230 points

Related Questions In GCP

0 votes
1 answer

Adding previlages to a user in GCP

The permission "servicenetworking.services.addPeering" is enclosed within the role "compute.NetworkAdmin". If you would ...READ MORE

answered Oct 10, 2019 in GCP by Sirajul
• 59,230 points
1,046 views
0 votes
1 answer

How to create a Cloud Filestore instance in GCP?

Hi@MD, You can create a Cloud Filestore instance in ...READ MORE

answered Nov 10, 2020 in GCP by akhtar
• 38,260 points
852 views
0 votes
1 answer

Unable to connect through SSH with VS-Code in Mac to a remote GCP VM

It looks to be a specific error ...READ MORE

answered Mar 20, 2022 in GCP by Korak
• 5,820 points
1,586 views
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP