In this chapter, you learn how to manage users from the command line. See Chapter 14 for more information on user administration with Ubuntu using graphical administration utilities.

Use the useradd command, along with a user's name to quickly create a user:

$ sudo useradd andrew

After creating the user, you must also create the user's initial password with the passwd command:

$ sudo passwd andrew Changing password for user andrew. New password: Retype new password:

passwd: all authentication tokens updated successfully.

Enter the new password twice. If you do not create an initial password for a new user, the user will not be able to log in.

You can view useradd's default new user settings by using the command and its -d option like this:

$ sudo useradd -D GROUP=10 0 HOME=/home INACTIVE=-1 EXPIRE=

SHELL=/bin/bash SKEL=/etc/skel

These options display the default group ID, home directory, account and password policy (active forever with no password expiration), the default shell, and the directory containing defaults for the shell.

The useradd command has many different command-line options. The command can be used to set policies and dates for the new user's password, assign a login shell, assign group membership, and other aspects of a user's account.

Was this article helpful?

0 0

Post a comment