Manage temporary workshop accounts (on a Linux system)
common.sh
-- defines variables or functions used by multiple other scriptscreate_accounts.sh
-- create local system accounts from a list of usernames and passwords in a text filecreate_instructor_passwords.sh
-- generate a list of random passwords for instructor accountscreate_workshop_passwords.sh
-- generate a list of random passwords for workshop accountsdelete_instructor_accounts.sh
-- delete the instructor accounts (uid, gid, home, etc.)delete_workshop_accounts.sh
-- delete the workshop accounts (uid, gid, home, etc.)
The scripts are written for the bash
shell and may not work with other shells.
The following external commands are used:
- cat
- fold
- getent
- head
- openssl
- tr
- useradd
- userdel
All external commands are found in common.sh
; everything else is pure bash.
This can be done well ahead of the workshop. Usernames and passwords can be distributed to participants before the accounts are created.
The script prints a tab-separated list of workshop accounts and random passwords. Redirect the output to a file for later use.
bash create_workshop_passwords.sh > {DATE}.workshop
bash create_instructor_passwords.sh > {DATE}.instructors
This can be done when it is time to enable access for workshop participants. The create_accounts.sh
script will attempt to create local system accounts with the usernames and passwords from a file.
bash create_accounts.sh {DATE}.workshop
bash create_accounts.sh {DATE}.instructors
Delete the temporary accounts and their home directories after the workshop is over.
bash delete_workshop_accounts.sh
bash delete_instructor_accounts.sh