Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between GCP service accounts and user accounts?

I wanted to use a service account to manage VM instances on GCE remotely. It did not work. Therefore this question. One difference I found between a service account and a user account, after many hours of trial-error, is that there seems no way to use a service account to ssh in to a VM instance.

What are the other differences?

Links I found related to my question:

  1. https://groups.google.com/forum/#!topic/gce-discussion/Z6OMpVhvowQ
  2. Logging into google compute engine with a service account
like image 850
JerryL Avatar asked Dec 13 '22 09:12

JerryL


1 Answers

The accepted answer is correct but lacks a deeper understanding of what credentials are in Google Cloud.

There are a number of types of credentials. User, Service Account, Group, Domain, etc. The difference is what the credentials represent and what is the authority for those credentials. Internally they are the same in regards to structure, content, etc.

All of the credential types are OAuth 2 credentials. A User Account credential is one that is issued by Google Accounts, G Suite or Identity Server. These credentials cannot be created by you or your software without Google. These credentials are issued by Google. Service Accounts, on the other hand, can create their own credentials as the service account contains the private key used to sign the credentials. The private key is used to create a Signed JWT that is then exchanged for OAuth Access Token, Refresh Token, and Identity Token. A Service Account is just a type of OAuth credential.

Google does not want User Credentials used to access Google Cloud resources except through the Google Cloud Console or Google Cloud SDK Tools and CLI. This is a security issue and design. Otherwise, the use and behavior are nearly identical except that some privileges cannot be assigned to some credential types.

like image 52
John Hanley Avatar answered Jan 14 '23 12:01

John Hanley