Manual Creation & Deletion¶
Create a SLURM User + Home Directory¶
Info
This script relies on ldap_manager.create_user (LDAPManager) in general.
This script safely creates a new LDAP user for SLURM with these features:
- Creates users with UIDs ≥ 10000 (automatically finding the next available UID)
- Adds the user to the SLURM group (GID 10001)
- Optionally sets account expiration (in days)
- Creates and properly configures the user's home directory
- Generates a random secure password or accepts a custom one
- Validates that the user doesn't already exist before creation
- Properly sets up all required LDAP attributes (
inetOrgPerson,posixAccount,shadowAccount) - Shows a summary of the created user account, including expiration date if applicable
- Adds a space quota to the user's directory
Variables to change if you've altered the defaults: dn=example,dn=com and ou=People, and the home directory base.
Create the script:
Allow execution:
Command:
Delete a SLURM User + Home Directory¶
This script safely deletes an LDAP user only if:
- The user's UID is ≥ 10000 (to avoid deleting system/local users).
- The user exists in LDAP (using
ldapsearchto resolve the DN). - If LDAP deletion succeeds, it removes the home directory.
Variables to change if you've altered the defaults: dn=example,dn=com and ou=People.
Create the script:
Allow execution:
Then delete with: