Sunday, November 21, 2010

useradd command UNIX

DESCRIPTION
      The useradd command creates a user login on the system by adding the
      appropriate entry to the /etc/passwd file and any security files,
      modifying the /etc/group file as necessary, creating a home directory,
      and copying the appropriate default files into the home directory
      depending on the command line options.  The new login remains locked
      until the passwd (see passwd(1)) command is invoked.
    New Behavior
      login will not be added to the primary group entry in the /etc/group
      file, even if the primary group is specified in the command line.
      However, the  login is added to the corresponding supplemental group
      in /etc/group file.
    Options
      The useradd command supports the following options:
           -u uid         Specifies the UID for the new user.  uid must be a
                          non-negative decimal integer less than MAXUID as
                          it is defined in the <param.h> header file.  uid
                          defaults to the next available unique number above
                          the maximum currently assigned number.  UIDs from
                          0-99 are reserved.
           -o             Allows the UID to be non-unique (i.e., a
                          duplicate).
           -g group       Specifies the integer group ID or character string
                          name of an existing group.  This defines the
                          primary group membership of the new login.  The
                          default for this option can be reset by invoking
                          useradd -D -g group.
           -G group       Specifies the integer group ID or character string
                          name of an existing group.  This defines the
                          supplemental group memberships of the new login.
                          Multiple groups may be specified as a comma
                          separated list.  Duplicates within group with the
                          -g and -G options are ignored.

RETURN VALUE
      useradd exits with one of the following values:
           0    Successful completion.
           2    Invalid command syntax.
           3    Invalid argument supplied to an option.
           4    uid is not unique (when -o is not used).
           6    The group specified with the -g option does not exist.
           9    login is not unique.
           10   Cannot modify the /etc/group file.  The login was added to
                the /etc/passwd file, but not to the /etc/group file.
           12   Unable to create the home directory (while using the -m
                option) or unable to complete the copy of skel_dir to the
                new home directory.
           13   Unable to open /etc/ptmp file or /etc/default file, or
                /etc/passwd file is non-existent.
           14   /etc/passwd, or /etc/ptmp, or /etc/default file busy.
                Another command may be modifying the /etc/passwd file.
           16   Cannot add the entry into the /etc/passwd file.
           54   Exceeding permissible limit of maximum members in a group.
                The /etc/group file is not modified.

No comments:

Post a Comment