DRBL

Diskless Remote Boot in Linux

DRBL management
Massively remove user accounts

2016/Apr/05


Massively remove user accounts

You can use any account tool to add or del user accounts, since DRBL uses NIS/YP, therefor you have to run "make -C /var/yp" after you create or remove accounts. One the other hand, two commands are available in DRBL, "drbl-useradd" and "drbl-userdel" are used to massively add or remove user accounts. drbl-userdel is used to remove user accounts, and the syntax:

CommandDescription
# drbl-userdel [-s|--single] username Remove an user with account name "username". For example, to remove the user "drbl":
    drbl-userdel -s drbl
    
# drbl-useradd [-r|--range] prefix start end [groupname] Remove (<end> - <start> + 1) users, the user name is from <prefix><start> to <prefix><end>; and the assigned group name is "groupname".
For example, to remove users cpc001 ~ cpc040 while keep the group:
    drbl-userdel -r cpc 1 40
    
If the groupname is given, then it will ask you if you want to remove the group. Ex:
    drbl-userdel -r cpc 1 40 groupcpc
    
PS. In this command, we only create accounts with maximun digits length "3", i.e. 001 to 999.
# drbl-userdel [-f|--file] filename Read the account setting from file "filename"; This is an extention of the above option "--range". For example, if you want to remove accounts s89101 ~ s89129 and tckps01 ~ tckps99, you can have a file "account.txt" first, which says:
    # account for student
    s           89101   89129 g3c6
    # account for teacher
    tckps       01      99 teacher
    
# account for student s 89101 89129 g3c6 # account for teacher tckps 01 99 teacher Then run "drbl-userdel -f account.txt",
and it will remove accounts s89101 ~ s89129 and tckps01 ~ tckps99. The group g3c6 and teacher will be deleted, too.
# drbl-userdel [-l|--list] filename nother option to massively create accounts from file "filename". but in this file, it describes the accounts line by line. The syntax for every line is
-------------------------
id groupname
-------------------------
For example, to remove 5 existing accounts, say they are "blake, steven, julian, kos, kevin", they all belong to group goodman.
Then have a file "accountlist.txt" first, and its content:
    # account for "goodman"
    blake goodman
    steven goodman
    julian goodman
    kos goodman
    kevin goodman
    
Then run "drbl-userdel -l accountlist.txt",
and these 5 existing accounts and the group "goodman" will be deleted.
# drbl-userdel [-g|--group] GROUPNAME To remove accounts based on group name "GROUPNAME".
For example, to remove all the accounts belong to the group "g3c5", you can run:
    drbl-userdel -g g3c5