Skip to content

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:

sudo nano /usr/local/bin/slurm-create

slurm-create

Allow execution:

sudo chmod +x /usr/local/bin/slurm-create

Command:

sudo slurm-create username "Full Name" [password] [expiration_days]

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 ldapsearch to 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:

sudo nano /usr/local/bin/slurm-delete

slurm-delete

Allow execution:

sudo chmod +x /usr/local/bin/slurm-delete

Then delete with:

sudo slurm-delete username