Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

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


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.