Solaris Useradd Syntax

This morning I’ve been installing a new Sun Fire V240, and like always, I couldn’t remember the syntax to add a user to the system. Unlike other flavors of UNIX, Solaris does not have a command like adduser which walks you through the process step-by-step, so you have to remember the four flags useradd requires, and in what order it expects to receive them. Since I don’t manually add users unless I’m installing a new server, I don’t run the command enough to remember the syntax.

Anyhow, so I always know where to find the syntax, and in the hopes of helping others who might find themselves forgetting it, here it is:

useradd -g group -c ‘User Name’ -d /path/to/home/directory -s /path/to/shell username

Should you need to create a new group, it’s easy:

groupadd groupname

11 thoughts on “Solaris Useradd Syntax

  1. Why useradd takes so much of time on high end machines ??

    # ptime useradd -g other -d /tmp/testuser -s /bin/csh testuser

    real 55.317
    user 0.806
    sys 1.088

    is ther any way to make it faster ?

  2. Pingback: » RHEL useradd Syntax

Leave a Reply