MAINTAIN USER ACCOUNTS IN LARGE MULTIUSER SYSTEMS WITH EASE

Maintaining user accounts in large multiuser systems is often as much of a chore as dealing with passwords. However, there are tools available to make dealing with user accounts simpler.

The first tool is the newuser command. This is a batch user creation tool that creates new user accounts. The newuser command reads a file in the same format as the /etc/passwd file with the notable exception that the password must be in cleartext. For instance, one line in the file might look like:

joe:mypass:1005:100:Joe User:/home/joe:/bin/bash

This line would tell newpass to create the user joe with the password "mypass", a user ID of 1005, and the group ID of 100. The name of the new user is noted as "Joe User" with a home directory of /home/joe and a shell of /bin/bash.

If you need to add only one user at a time, you can use useradd to doso. To add the same account for joe as noted above, you would use useradd:

# useradd -c "Joe User" -d /home/joe -g 100 -s /bin/bash -u 1005 joe

After you create the user, you will need to use the passwd command to give the account a password; useradd does not prompt for one. To complement useradd, there is the groupadd command that works in a similar fashion. To add a group called "sysusers" with a group ID of 1000, you would use:

# groupadd -g 1000 sysusers

Along with these two creation tools, you can use the userdel and groupdel commands. These take as input the name of the user or group that you wish to delete.