Skip to content

Instantly share code, notes, and snippets.

@blizzz
Created February 18, 2021 18:01
Show Gist options
  • Save blizzz/47dad2e002cb8128e7c79d22c5183cf9 to your computer and use it in GitHub Desktop.
Save blizzz/47dad2e002cb8128e7c79d22c5183cf9 to your computer and use it in GitHub Desktop.
randomly assign groups to groups in samba4
#!/bin/bash
for i in {1..200}
do
R_GID="Osmium ${i}"
MEMBERSHIPS="$((($RANDOM % 3)))"
for j in {1..${MEMBERSHIPS}}; do
R_GROUP="Osmium $((($RANDOM % 200) + 1))"
samba-tool group addmembers "${R_GROUP}" "${R_GID}" || true
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment