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
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
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
i have a lot of unused user in my server
I recall a discussion like that with @robb about sysadmin work at school every year to create users
I talked about something like that : https://wiki.contribs.org/Lazy_Admin_Tools
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
a script to delete all users, before to recreate them by a script
this time for fun I tried PHP @davidep
I like the idea.
Just a couple:
- make sure to exit with non 0 code in case of error
- output something only if the deletion fails (https://en.wikipedia.org/wiki/Talk%3AUnix_philosophy#No_news_is_good_news)
can you explain me this line of code?
if( ! esmith::event::event_signal(‘user-delete’, $username) ) {
what is event_signal?
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)
)
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.