Hi there,
I use the following cron job that runs every night to add new users:
#!/bin/bash
function usersInGrp {
echo -n $(getent group "$*" | cut -d':' -f 4- | awk -F',' '$1=$1')
}
for user in $(usersInGrp 'cluster.users'; usersInGrp
'ALT_DOMAIN1+cluster.users'; usersInGrp 'ALT_DOMAIN2+cluster.users'?)
do
# Check for existing account.
if [ "$(sacctmgr -nP show user $user | awk -F'|' '{print $2}')" == "" ];
then
# User has no default account. Add one.
sacctmgr add user $user DefaultAccount=nullAccount
fi
done
There's also a relatively simple inverse script to remove users who are no
longer in the group.
Regards,
Sam
________________________________
Sam Hawarden
Assistant Research Fellow
Pathology Department
Dunedin School of Medicine
sam.hawarden(at)otago.ac.nz
DDI: +64 (0)3 470 3455
Mb: +64 (0)21 898 895
Rm 228 Hercus Building
________________________________
From: slurm-users <[email protected]> on behalf of
Fulcomer, Samuel <[email protected]>
Sent: Friday, 21 December 2018 12:02
To: Slurm User Community List
Subject: Re: [slurm-users] Accounting: Default Associations for Unknown Accounts
Yes, in a way. In thinking about this for Brown (we haven't implemented it,
yet), we've the idea of having a Linux cron job periodically query the group
membership of the AD group granted access to the HPC resource, and adding any
new users to the SLURM accounting database.
We're at the point of using AD for ssh/login authentication via sssd, but still
maintain an cluster/internal NIS database for pwent and cluster-specific group
info (i.e., only the login gateways do AD authentication). Our SLURM
associations are updated automatically when the NIS account is created or
modified (via webmin).
On Thu, Dec 20, 2018 at 5:46 PM Ulf <[email protected]<mailto:[email protected]>> wrote:
Hello,
we think about switch to SLURM. Currently we grant access to the cluster using
a active directory group, everyone in this group is allowed to run jobs.
So the users are not known to the SLURM accounting database.
Is it possible to automatically add every new user to an default account
without manually adding the user with "sacctmgr add user user123 Account=test".
Regards
Ulf