Previous Section  < Day Day Up >  Next Section

Recipe 8.5. Adding Users with adduser

8.5.1 Problem

You want to use adduser instead of useradd, because it walks you through a complete new user setup—password, GECOS fields, and all.

8.5.2 Solution

To add a user, simply run adduser newusername and follow the prompts:

# adduser anitab

Adding user anitab...

Adding new group anitab (1008).

Adding new user anitab (1008) with group anitab.

Creating home directory /home/anitab.

Copying files from /etc/skel

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

Changing the user information for anitab

Enter the new value, or press ENTER for the default

        Full Name [  ]:

        Room Number [  ]:

        Work Phone [  ]:

        Home Phone [  ]:

        Other [  ]:

Is the information correct? [y/n] y

You can assign a UID, overriding the default:

# adduser —uid 1500 anitab

adduser's defaults are configured in /etc/adduser.conf.

8.5.3 Discussion

The full name is the only important part of the user information. Any external programs that use /etc/passwd, such as mail servers, need the full user name. And, believe it or not, finger still lingers on most Linuxes:

$ finger anitab

Login: anitab                  Name:

Directory: /home/anitab          Shell: /bin/bash

On since Sun May 30 08:46 (PDT) on tty1   10 hours 55 minutes idle

     (messages off)

No mail.

No plan.

Phone 555-5555

Office Fooo

The other fields for the user data can contain anything you want. Using these fields is a quick and easy way to keep notes on users, or to categorize them.

Users can change their own room and phone numbers with chfn, but they can't change the full name or the "other" field.

8.5.4 See Also

  • adduser(8), adduser.conf(5), finger(1)

    Previous Section  < Day Day Up >  Next Section