According to pw usermod
documentation:
-G grouplist Set secondary group memberships for an account. grouplist is a comma, space, or tab-separated list of group names or group numbers. The user is added to the groups specified in grouplist, and removed from all groups not specified. The current login session is not affected by group member- ship changes, which only take effect when the user recon- nects. Note: do not add a user to their primary group with grouplist.
I tried
pw usermod test_user -G ''
but that command has no effect at all.
Workaround: Delete a user from all groups except one:
pw usermod test_user -G test_group
and then delete user from that group:
pw groupmod test_group -d test_user
But this requires creating a trash group or knowing one of users groups. Is there a simpler way?