Sysadmin scripts to create Users in school

Just for the sake of my curiosity, I recall the need of your french colleague (sysadmin in a french school, about 900 account and 400 computers), each year he deletes all the accounts and recreates new one. He uses the lazzy-admin-tools on SME-Server for this purpose, I am not sure we have the same thing here

1 Like

For import new user i follow this step http://docs.nethserver.org/en/v7/accounts.html#import-accounts-from-plain-text-files

For delete i don’t know if exist a script, i delete from web interface one at a time :slight_smile:

1 Like

How many users you delete each years ?

i need to delete about 50 users each year but i’m very lazy… i don’t delete all :slightly_smiling_face:
i have a lot of unused user in my server :smiley:

1 Like

I recall a discussion like that with @robb about sysadmin work at school every year to create users

1 Like

I talked about something like that : https://wiki.contribs.org/Lazy_Admin_Tools

@dev_team

a quick hack of the import_users to delete a list of users, do you think we could add it to nethserver-sssd ?

https://gist.github.com/stephdl/e3f65a0c433c6f1b616eb4215b35f111

it takes only one argument in a file, you can decide what is the separator (default one user per line)

Use either username or username@domainName

tips: you should be able to delete users from the list you used to create them

3 Likes

a script to delete all users, before to recreate them by a script

this time for fun I tried PHP @davidep

1 Like

I like the idea.
Just a couple:

1 Like

can you explain me this line of code?

if( ! esmith::event::event_signal(‘user-delete’, $username) ) {

what is event_signal?

1 Like

if the event_signal fails (return a code 1) then a warn is displayed, event_signal is the equivalent of signal-event but this time it used only in perl script (esmith::event::event_signal(‘user-delete’, $username))

2 Likes

We modified the import script from nethserver-mail package to import/delete and create needed groups inside NS. This is supported on 6.x version but I cannot assure on 7.x (probably it does). Also, we don’t have any web interface for the feature but it is fine.

Here are the sources https://git.libreschool.org/LibreSchool/nethserver-usercsvimport

All credits go to @paspo anyways.

5 Likes