Score:0

How to customize sudo permissions when using OS Login?

in flag

When OS Login is enabled, and a user is granted access by having either the "Compute OS Login" or "Compute OS Admin Login" roles, they can run sudo.

In my experience, the per-user sudoers file always has this permission:

# cat /var/google-sudoers.d/first_last_example_com 
first_last_example_com ALL=(ALL) NOPASSWD: ALL

Is it possible to customize these permissions or even disable sudo completely for a specific user or group?

Score:1
cn flag

A user with the role roles/compute.osLogin should be able to login but should not be able to run sudo.

The role roles/compute.osAdminLogin is required to login and use sudo.

Double-check the IAM roles you have assigned to users.

There are roles that include roles/compute.osAdminLogin, so you might be granting admin rights without realizing it. If the user has the primitive roles/owner or roles/admin role, or if they have roles/compute.instanceAdmin, these roles already include instance access roles with administrator permissions.

Google Compute Engine supports startup scripts link. You can remove users in the google-sudoers group by adding the following script.

#!/bin/bash
sudo deluser USERNAME google-sudoers
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.