GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
Wajig Adduser |
20200804
$ wajig adduser fred mary Adding user `fred' ... Adding new group `fred' (1001) ... Adding new user `fred' (1001) with group `fred' ... Creating home directory `/home/fred' ... Copying files from `/etc/skel' ... Adding user `mary' ... Adding new group `mary' (1002) ... Adding new user `mary' (1002) with group `mary' ... Creating home directory `/home/mary' ... Copying files from `/etc/skel' ... fred:oi8so4Tha4fei8Ew mary:ohBu4eZeiz0bahth |
To add users listed in a file, one username per line, we can use the
--file
option:
$ cat students.txt fred mary $ wajig adduser --file students.txt Adding user `fred' ... Adding new group `fred' (1001) ... Adding new user `fred' (1001) with group `fred' ... Creating home directory `/home/fred' ... Copying files from `/etc/skel' ... Adding user `mary' ... Adding new group `mary' (1002) ... Adding new user `mary' (1002) with group `mary' ... Creating home directory `/home/mary' ... Copying files from `/etc/skel' ... fred:Xie2eij8oi8phoo8 mary:ohbi2Oor5ohg9phe |
Another way to do the same thing is through the shell command line:
$ cat students.txt | xargs echo fred mary $ wajig adduser `cat students.txt | xargs echo` |
To save just the username:password lines to file:
$ wajig adduser --file students.txt | grep -E -v '^(Adding|Creating|Copying)|^$' > students.pwd $ cat students.pwd fred:fooTeeFai0Lah9Ie mary:gei5Aceo4chai3ba |