The answer is no, the SSH connection will fail because user1@domain.com lacks the compute.osLogin role. When OS Login is enabled on a Compute Engine instance, SSH access is governed by IAM permissions, specifically the compute.instances.osLogin permission, which is included in roles like compute.osLogin. Without this role, the user cannot authenticate via OS Login, regardless of the service account attached to the instance—that service account only authorizes the instance to call Google Cloud APIs, not to grant SSH access to users. On the Google Professional Cloud Security Engineer exam, this scenario tests your understanding of the separation between instance identity and user identity; a common trap is assuming the attached service account somehow delegates SSH rights. Remember: OS Login ties SSH to IAM roles, not service accounts. Memory tip: "OS Login needs a role, not a service account—think 'role to roll in, service account to serve APIs.'"
PCSE Practice Question: Configuring access within a cloud solution environment
This PCSE practice question tests your understanding of configuring access within a cloud solution environment. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
The following gcloud command output shows the IAM policy for a project:
- role: roles/compute.instanceAdmin
members:
- serviceAccount:sa1@project.iam.gserviceaccount.com
- role: roles/compute.viewer
members:
- user:user1@domain.com
- role: roles/iam.serviceAccountUser
members:
- user:user1@domain.com
User user1@domain.com tries to SSH into a Compute Engine instance that has the service account sa1@project.iam.gserviceaccount.com attached. Will the SSH connection succeed? (Assume no other policies)
The following gcloud command output shows the IAM policy for a project:
- role: roles/compute.instanceAdmin
members:
- serviceAccount:sa1@project.iam.gserviceaccount.com
- role: roles/compute.viewer
members:
- user:user1@domain.com
- role: roles/iam.serviceAccountUser
members:
- user:user1@domain.com
A
No, because user1 lacks compute.instances.osLogin permission.
Why wrong: While this permission is part of the osLogin role, it's not the complete reason; the role itself is missing.
B
No, because user1 needs a role such as compute.osLogin to SSH into the instance.
The compute.osLogin role (or compute.osAdminLogin) is required for SSH access via OS Login.
C
Yes, because user1 has iam.serviceAccountUser role on the service account, which is required to use it.
Why wrong: Having iam.serviceAccountUser allows impersonation but does not grant SSH access to the instance.
D
Yes, because user1 has compute.viewer role.
Why wrong: compute.viewer only provides read access to instance metadata, not SSH access.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
No, because user1 needs a role such as compute.osLogin to SSH into the instance.
Option B is correct because SSH access to a Compute Engine instance requires the user to have the compute.osLogin role (or a role that includes compute.instances.osLogin permission) when OS Login is enabled. Without OS Login, the user needs the compute.instances.setMetadata permission to add SSH keys. The service account attached to the instance does not grant SSH access; it only allows the instance to authenticate to Google Cloud APIs. User1 has no relevant IAM roles for SSH, so the connection will fail.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
No, because user1 lacks compute.instances.osLogin permission.
Why it's wrong here
While this permission is part of the osLogin role, it's not the complete reason; the role itself is missing.
✓
No, because user1 needs a role such as compute.osLogin to SSH into the instance.
Why this is correct
The compute.osLogin role (or compute.osAdminLogin) is required for SSH access via OS Login.
Related concept
Read the scenario before looking for a memorised answer.
✗
Yes, because user1 has iam.serviceAccountUser role on the service account, which is required to use it.
Why it's wrong here
Having iam.serviceAccountUser allows impersonation but does not grant SSH access to the instance.
✗
Yes, because user1 has compute.viewer role.
Why it's wrong here
compute.viewer only provides read access to instance metadata, not SSH access.
Common exam traps
Common exam trap: answer the scenario, not the keyword
Google Cloud often tests the misconception that having the iam.serviceAccountUser role on a service account attached to an instance grants SSH access, when in reality it only allows impersonation of the service account for API calls, not interactive login.
Detailed technical explanation
How to think about this question
Under the hood, SSH access to Compute Engine relies on either OS Login (which uses IAM permissions like compute.instances.osLogin) or metadata-based SSH keys (which require compute.instances.setMetadata). The service account attached to an instance is used by the instance itself to call Google APIs, not by users to authenticate for SSH. A real-world scenario where this matters is when a developer assumes they can SSH because they have the iam.serviceAccountUser role on the instance's service account, but they still need explicit compute.osLogin or metadata permissions.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Configuring access within a cloud solution environment — This question tests Configuring access within a cloud solution environment — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: No, because user1 needs a role such as compute.osLogin to SSH into the instance. — Option B is correct because SSH access to a Compute Engine instance requires the user to have the compute.osLogin role (or a role that includes compute.instances.osLogin permission) when OS Login is enabled. Without OS Login, the user needs the compute.instances.setMetadata permission to add SSH keys. The service account attached to the instance does not grant SSH access; it only allows the instance to authenticate to Google Cloud APIs. User1 has no relevant IAM roles for SSH, so the connection will fail.
What should I do if I get this PCSE question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This PCSE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCSE exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.