DRBL

Diskless Remote Boot in Linux

DRBL management
Massively create user accounts

2016/Apr/05


Massively create 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 all" 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-useradd is used to add user accounts, and the syntax:

CommandDescription
# drbl-useradd [-s|--single] username group Create an account, for examples, to new an user "drbl" with group "penguin"
    drbl-useradd -s drbl penguin
    
# drbl-useradd [-r|--range] prefix start end groupname [password_opt] Create (<end> - <start> + 1) users, username start with <prefix><start> to <prefix><end>, group name is "groupname".
password_opt details see this
Created accounts are in file "username_pw.txt".
For example, to create accounts: cpc001 to cpc040 with group name "g3c5", and it's password is randomly generated with length 7. Run like this:
    drbl-useradd -r cpc 1 40 g3c5 7
    
PS. In this command, we only create accounts with maximun digits length "3", i.e. 001 to 999.
# drbl-useradd [-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 create accounts s89101 ~ s89129 and tckps01 ~ tckps99, you can have a file "account.txt" first, which says:
    # account for student
    s           89101   89129 g3c6 7
    # account for teacher
    tckps       01      99 teacher neverforget
    
Then run"drbl-useradd -f account.txt",
Created accounts are in file "username_pw.txt".
# drbl-useradd [-l|--list] filename Another 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 password_opt
-------------------------
password_opt details see this.
For example, to have 5 new accounts, say they are "blake, steven, julian, kos, kevin", the group is "goodman" or "wiseman", and their passwords are assigned separately.
Then have a file "accountlist.txt" first, and its content:
    # account for group "goodman" 
    blake goodman ilovepinwife
    steven goodman ilovesteven
    julian goodman ilovemac
    kevin goodman 6
    # account for group "wiseman" 
    kos wiseman 9
    
Then run "drbl-useradd -l accountlist.txt",
Created accounts are in file "username_pw.txt".