homeblog

Onboard New Workspace Users Without 2-Step Verification Lockouts

by
Christopher F.
date
read
11 min
filed
How To

SKILL LEVEL: Intermediate.

Turning on enforced 2-Step Verification (2SV) is one of the best security moves a small organization can make in Google Workspace. But it creates a new problem. A brand-new account has no second factor yet. If that account sits in an organizational unit (OU) where 2SV is enforced, the first sign-in can end with a message telling the person to contact their administrator. New board members, volunteers and staff who don’t finish setup right away stay locked out, and their invitations quietly expire.

In this article, we’ll set up a small, controlled bridge for new users: an exception group where 2SV is allowed but not enforced. You add new users to it before they sign in for the first time, they enroll in 2SV, and you take them out again. We’ll use GAM7, the free command-line tool for Workspace admins, to check status and to build the “add” and “remove” lists for a whole group of new users at once.

info
This article is based on our work for clients. Admin console steps need a super administrator account. The GAM commands assume GAM7 is already installed and authorized for your domain. Replace example.org, the group address and the OU path with your own.

Tested on Ubuntu 24.04.5 LTS (kernel 6.8.0-151-generic), bash 5.2 with GNU coreutils and awk, November 2026: the 2sv-bridge-lists script and the sample-data demo. The GAM7 and Admin console steps need a real Workspace domain, so they were checked against Google’s Workspace Admin Help and the GAM7 wiki instead.

Why new users get locked out

When you enforce 2SV, Google offers a New user enrollment period (from 1 day to 6 months) during which new accounts can sign in with just a password. That helps, but it doesn’t fit how volunteers and board members actually sign up. Some sign in weeks later. Some never sign in at all until someone chases them. Google’s help doesn’t say exactly when the period starts, so plan as if the clock starts when you create the account.

There’s a second timer. When you email a new user their account details from the Admin console, the welcome message includes a link to set their password, and that link expires after 48 hours. Miss both windows and the person is stuck until an admin steps in.

Google’s own fix, described in Avoid account lockouts when 2-Step Verification is enforced, is to put users in a group where 2SV isn’t enforced until they enroll, then remove them. Google’s steps end with moving each user out of the group once they’ve enrolled, so treat the group as a temporary bridge, not a permanent exemption.

What we’re building

  • One exception group with 2SV allowed but not enforced. It should be empty most of the time.
  • A per-user workflow for one new person.
  • A cohort workflow for a batch of new users in one OU, with a script that produces “add to group” and “safe to remove” lists.
  • A safeguard: nobody leaves the group until GAM confirms they’re enrolled.

Create the exception group (one time)

  1. In the Google Admin console, go to Directory > Groups and click Create group. Use a clear address such as [email protected] and a description like “Temporary. New users only, until they enroll in 2SV.”
  2. Under access settings, make sure only invited users can join and only managers can see the member list. Nobody should be able to add themselves to an exception group.
  3. Go to Security > Authentication > 2-step verification.
  4. In the left panel, open Groups and select [email protected].
  5. Check Allow users to turn on 2-Step Verification, set Enforcement to Off, and click Save (or Override).

The checkbox in step 5 matters. If you turn enforcement off for the group but leave the checkbox clear, people in the group can’t enroll, which defeats the point.

warn
Create the group in the Admin console, with GAM (Directory API) or with Google Cloud Directory Sync. Groups made at groups.google.com can’t be used as configuration groups. Also, Google says a 2SV policy set on a child OU always beats a group setting. Enforce 2SV on a parent OU (or the top level) and let child OUs inherit, or the exception group may do nothing. Test with a spare account first.

If you prefer GAM, you can create and lock down the group like this:

gam create group [email protected] name "2SV exception (temporary)" description "New users only, until they enroll in 2SV"
gam update group [email protected] whocanjoin invited_can_join whocanviewmembership all_managers_can_view allowexternalmembers false

You still need the Admin console for the 2SV setting in steps 3 to 5.

Onboard one new user

Start by checking the account. quick skips aliases, groups and licenses so the output stays short:

gam info user [email protected] quick

Look for these lines:

2-step enrolled: False
2-step enforced: True
Last login time: Never

Add the user to the exception group:

gam update group [email protected] add member user [email protected]

Changes can take a little while to apply. Run gam info user [email protected] quick again and wait until it shows 2-step enforced: False before you send anything.

Next, give the person a way in. There are two good options. Don’t email a password in plain text:

  • Setup link. In the Admin console, go to Directory > Users, point to the user and click Reset password. Keep Ask the user to change their password checked, confirm the dialog, then click Email Password and Send, addressed to their personal email. They get a link to set their own password. That link is only sent if the checkbox is ticked. Ask them to use it promptly. The welcome email’s link expires after 48 hours, and Google doesn’t publish an expiry for links sent this way.
  • Temporary password, shared another way. Set a temporary password with the same checkbox ticked, and give it to them by phone, in person, or in an encrypted message.

Either way, tell the person in advance what is coming and from whom. Unexpected “set up your account” emails look like phishing, and people are right to hesitate. For the temporary password route, ask them to type accounts.google.com into their browser themselves rather than clicking a link.

Ask them to turn on 2SV right after their first sign-in. They can go to myaccount.google.com, choose Security, then 2-Step Verification, or open myaccount.google.com/signinoptions/twosv directly.

Remove them only after they’re enrolled

This is the step that causes lockouts if it’s done in the wrong order. Removing someone before they enroll puts them straight back under enforcement. Check first:

gam info user [email protected] quick | grep '2-step'

Only when it shows 2-step enrolled: True, remove them:

gam update group [email protected] remove member user [email protected]

Use GAM (or the user’s own page in the Admin console) for this check, not Reporting > User Reports > Security. Google notes that the report can be up to 48 hours behind. gam info user reads the user’s record directly. Bulk exports with gam print users query … go through Google’s search index, which usually updates within an hour but can take up to 36 hours. That’s why the removal loop below re-checks each person live.

Handle a whole cohort with one script

When a board, a volunteer class or a new program team starts together, checking people one by one gets tedious. The script below compares two GAM exports, one of the users in the OU and one of the group’s members, and writes these lists:

  • add_to_group.txt: not enrolled and not yet in the group.
  • can_remove.txt: in the group and already enrolled.
  • never_signed_in.txt: not enrolled and never signed in. Their setup links have probably expired.
  • outside_ou.txt: in the group but not in this OU. Check these by hand, since nobody should stay in the group for long.

It uses only awk, sort and comm. It matches columns by header name, so the column order in GAM’s output doesn’t matter. Save it (with sudo) as /usr/local/bin/2sv-bridge-lists:

#!/usr/bin/env bash
# 2sv-bridge-lists: compare a GAM7 user export with the 2SV exception group.
# Usage: 2sv-bridge-lists users.csv members.csv [output-dir]
set -euo pipefail
export LC_ALL=C

if [ "$#" -lt 2 ]; then
  echo "usage: 2sv-bridge-lists users.csv members.csv [output-dir]" >&2
  exit 2
fi

users_csv=$1
members_csv=$2
out=${3:-.}
mkdir -p "$out"

# Print the named columns of a CSV file (matched by header, any case),
# lower-cased and comma-separated. Fields must not contain commas.
cols() {
  local file=$1
  shift
  awk -F, -v want="$*" '
    NR == 1 {
      n = split(tolower(want), w, " ")
      for (i = 1; i <= NF; i++) {
        h = tolower($i)
        gsub(/[\r"]/, "", h)
        idx[h] = i
      }
      for (j = 1; j <= n; j++) {
        if (!(w[j] in idx)) {
          print "missing column: " w[j] > "/dev/stderr"
          exit 1
        }
      }
      next
    }
    {
      line = ""
      for (j = 1; j <= n; j++) {
        v = tolower($(idx[w[j]]))
        gsub(/[\r"]/, "", v)
        line = (j == 1) ? v : line "," v
      }
      print line
    }' "$file"
}

cols "$users_csv" primaryemail isenrolledin2sv lastlogintime > "$out/users.tmp"
cols "$members_csv" email | sort -u > "$out/exempt_members.txt"

awk -F, '$2 != "true" { print $1 }' "$out/users.tmp" | sort -u > "$out/needs_exemption.txt"
awk -F, '$2 == "true" { print $1 }' "$out/users.tmp" | sort -u > "$out/enrolled.txt"
awk -F, '$2 != "true" && ($3 == "never" || $3 ~ /^1970/) { print $1 }' "$out/users.tmp" \
  | sort -u > "$out/never_signed_in.txt"
cut -d, -f1 "$out/users.tmp" | sort -u > "$out/in_ou.txt"
rm -f "$out/users.tmp"

# Not enrolled and not yet in the group: add these.
comm -23 "$out/needs_exemption.txt" "$out/exempt_members.txt" > "$out/add_to_group.txt"
# In the group and already enrolled: safe to remove (re-check first).
comm -12 "$out/enrolled.txt" "$out/exempt_members.txt" > "$out/can_remove.txt"
# In the group but not in this OU export: check by hand.
comm -13 "$out/in_ou.txt" "$out/exempt_members.txt" > "$out/outside_ou.txt"

for f in add_to_group can_remove never_signed_in outside_ou; do
  printf '%-20s %s\n' "$f.txt" "$(wc -l < "$out/$f.txt")"
done
sudo chmod 0755 /usr/local/bin/2sv-bridge-lists

You can try it without GAM using sample data shaped like GAM’s CSV output:

mkdir -p ~/2sv-demo
cat > ~/2sv-demo/users.csv <<'EOF'
primaryEmail,changePasswordAtNextLogin,isEnforcedIn2Sv,isEnrolledIn2Sv,lastLoginTime
[email protected],True,True,False,Never
[email protected],False,False,True,2026-01-05T15:04:05.000Z
[email protected],False,False,False,2026-01-06T09:30:00.000Z
[email protected],True,False,False,Never
EOF
cat > ~/2sv-demo/members.csv <<'EOF'
group,email
[email protected],[email protected]
[email protected],[email protected]
[email protected],[email protected]
[email protected],[email protected]
EOF
$ 2sv-bridge-lists ~/2sv-demo/users.csv ~/2sv-demo/members.csv ~/2sv-demo/out
add_to_group.txt     1
can_remove.txt       1
never_signed_in.txt  2
outside_ou.txt       1
$ cat ~/2sv-demo/out/add_to_group.txt
[email protected]
$ cat ~/2sv-demo/out/can_remove.txt
[email protected]
$ cat ~/2sv-demo/out/never_signed_in.txt
[email protected]
[email protected]

In the sample, Ana needs adding. Ben has enrolled and can come out. Cam and Dee are already in the group and still waiting, and Dee has never signed in, so Dee needs a fresh setup link. The old volunteer account shouldn’t still be there.

Run it against your domain

Export the cohort’s OU and the group’s members, then build the lists. The orgUnitPath query also matches sub-OUs of /Example/Cohort. Accounts you created in the last day may not show up in the export yet. Add those people with the single-user command above instead of waiting for them to appear in add_to_group.txt.

OU='/Example/Cohort'
GROUP='[email protected]'
mkdir -p ~/2sv-cohort && cd ~/2sv-cohort
gam print users query "orgUnitPath='$OU'" fields primaryemail,lastlogintime,isenrolledin2sv,isenforcedin2sv,changepasswordatnextlogin > users.csv
gam print group-members group "$GROUP" fields email > members.csv
2sv-bridge-lists users.csv members.csv out

Add the people who need the bridge:

if [ -s out/add_to_group.txt ]; then
  gam update group "$GROUP" add member users "$(paste -sd, out/add_to_group.txt)"
fi

For everyone in never_signed_in.txt, send a fresh setup link with Reset password as described above.

To remove people, re-check each one live, right before removing them. The export can be up to 36 hours behind, and someone could have removed their only second factor since then:

while read -r u; do
  if gam info user "$u" quick < /dev/null | grep -q '2-step enrolled: True'; then
    gam update group "$GROUP" remove member user "$u" < /dev/null
  else
    echo "keeping $u: not enrolled yet" >&2
  fi
done < out/can_remove.txt

Run the export and the script again every few days until add_to_group.txt and can_remove.txt are both empty and the group is empty again.

Common problems

  • The user is in the group but is still blocked. Allow time for the change to apply, then check 2-step enforced with GAM. If it stays True, look for 2SV enforcement set directly on the user’s own OU. That setting beats the group.
  • The user can’t find the 2SV option. Allow users to turn on 2-Step Verification isn’t checked for the group.
  • “Is this email phishing?” Tell people in advance, through another channel, what will arrive and from whom. For temporary passwords, have them type the sign-in address themselves.
  • The setup link has expired. Reset the password again with Ask the user to change their password checked and email the new link.
  • The security report says someone isn’t enrolled when they are. The report can lag by up to 48 hours. Trust gam info user.
  • Someone was removed too early and is locked out. Add them back to the group, have them enroll, confirm with GAM, then remove them.
  • The group keeps growing. Check outside_ou.txt. Every name in the group should belong to someone who is actively enrolling.

Checklist

  • 2SV is enforced on a parent OU, and child OUs inherit it.
  • The exception group was created in the Admin console or with GAM, and only invited users can join.
  • The group has Allow users to turn on 2-Step Verification checked and enforcement Off.
  • New users are added to the group before they get sign-in details, and GAM shows 2-step enforced: False.
  • Sign-in details go to a personal address as a setup link, or by phone or in person. Never a password in plain email.
  • People know what to expect, and from whom.
  • Each user is removed only after gam info user shows 2-step enrolled: True.
  • The group is empty again once the cohort is done.

Need more help?

Onboarding a new board or volunteer cohort and don’t want to spend the week unlocking accounts? Our IT Operations service covers Google Workspace administration and security for small nonprofits, law firms and mission-driven organizations. For guidance you can hand to staff, see our Client Security Guides. Contact us and we’ll get right back to you.