How to Configure Google Compute Engine SSH Access Control
You set up google compute engine ssh access control by pairing cloud identity roles with OS Login. You can also sign OpenSSH certificates to verify users and hosts without static keys. Many teams start by placing manual public keys inside project metadata. This quick fix gives every user wide reach across every virtual machine in the project. Broad project roles let a single stolen key open every server at once. How google compute engine ssh access control works Google Cloud offers two main p
SSH Access Management + Customer Support Access to Production: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up google compute engine ssh access control by pairing cloud identity roles with OS Login. You can also sign OpenSSH certificates to verify users and hosts without static keys. Many teams start by placing manual public keys inside project metadata. This quick fix gives every user wide reach across every virtual machine in the project. Broad project roles let a single stolen key open every server at once.
How google compute engine ssh access control works
Google Cloud offers two main paths to manage who logs into your Linux machines. The old method stores public SSH keys directly in project or instance metadata. A background guest agent on the virtual machine reads those keys and updates local user files. This metadata path is hard to track when people leave your team.
The modern method uses OS Login to link Linux accounts to cloud identity profiles. Instead of managing text files on each machine, you grant specific cloud roles to users. You assign a basic role for standard user login or an admin role for root privileges. When an engineer runs a login command, the virtual machine checks their cloud identity permissions first. You can also require two-step checks at the cloud level before the shell opens.
Some teams add OpenSSH certificates on top of their cloud setup for tighter control. OpenSSH key signing creates a certificate that holds a public key and identity details. It also stores one or more principal names and a set of options. A Certificate Authority key signs this bundle in a format much simpler than X.509 certificates. Unless you set a time window during signing, OpenSSH certificates remain valid forever by default. Setting a short window makes sure temporary keys expire on their own.
How to scope instance permissions
To keep servers safe, avoid granting login roles at the top project level. Granting roles at the project level lets a user log into every machine there. Instead, bind the login role directly to the single virtual machine that the engineer needs. You should also attach a dedicated service account to each machine to limit its cloud reach.
Next, check how network traffic reaches your servers. Removing public IP addresses stops outside bots from scanning your SSH ports. Teams often route private traffic through a single bastion host or a cloud tunnel. This step shrinks your network footprint so only approved internal paths reach port twenty-two.
SSH Access Management + Customer Support Access to Production: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native setup solves and what it misses
Native cloud roles and OS Login solve the problem of who can open a shell. They tie server entry to your central user directory and stop manual key sprawl. When you remove a user from your cloud directory, their server login stops working right away.
Still, native setup only checks the user at the front door. Once the shell starts, the cloud role does not watch or filter individual commands in flight. A user with root login rights can read private files, change system settings, or drop tables. Standard cloud logs show who logged in, but they do not capture what commands ran inside. Also, if a script outputs sensitive customer emails or phone numbers, the terminal shows everything in plain text. Teams still need a way to inspect active commands and rewrite sensitive output like card numbers.
Inspect one-shot SSH commands and file tasks
SSH certificates and host rules decide who is allowed on a machine. Setup alone does not check single commands or block sftp reads on sensitive paths. By design, hoop.dev runs an inline open-source SSH listener on the host where engineers and AI agents keep their normal ssh, sftp, and scp tools. On every production command or file operation, hoop.dev decides whether to pass, mask, block, or hold it for approval.
First, hoop.dev guardrails check one-shot commands and file paths before they run, and hoop.dev data masking masks matched values in file downloads. The audit trail logs the certificate principal, requested action, and verdict without storing session content. Interactive shells carry no guardrails and can be turned off when every action must be checked. Explore the code on GitHub.
Frequently asked questions
Why should I use OS Login instead of metadata SSH keys?
OS Login links Linux accounts directly to your central cloud identity directory. When someone leaves the team, revoking their cloud account blocks their server login right away. Metadata keys stay on the server until someone deletes them by hand.
How do I stop users from getting root rights on every server?
Do not assign the admin login role at the whole project level. Assign the standard non-admin login role on the specific instance instead. Only grant the admin role to users who must run root commands on that one machine.
Do OpenSSH certificates expire on their own?
No, OpenSSH certificates stay valid forever unless you define a time limit when signing the key. You must specify a validity window during the signing step so user certificates expire on schedule.
Related guides
In this post