6.9 wajig adduser

20220703

To allow a user to log on to the computer they will need a user account. A user account can be added with wajig’s adduser command. See also deluser to delete a user and disuser to disable a user.

$ 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

To update the password for an existing user, the adduser command will update the password while reporting that the user already exists.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0