Go to main content

Managing User Accounts and User Environments in Oracle® Solaris 11.4

Exit Print View

Updated: April 2019

How to Add a User

  1. Become an administrator or a user with the User Management rights profile.

    See Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.4.

  2. Create a local user.
    # useradd -d dir -m [-S ldap] username
    –d dir

    Specifies the location of the home directory of the user. An optional server name can be added to the directory path, such as system1:/home/export/jdoe. The host information is written to auto_home and used by the automounter to mount the home directory.


    Creates a local home directory on the system for the user if the directory does not yet exist. However, if the –d option specifies a host that is remote, then the home directory is not created.

    If the directory does not yet exist, the home directory is created under the parent directory which is assumed as the the mount point of a ZFS dataset, such as export/home. The newly created directory is created as a multilevel dataset.

    –S ldap

    This option indicates that you are using LDAP and its repository for the account information. If you use LDAP, you can also assign default attributes by to the default@ user name which are applied to all users. For example:

    $ useradd -S -K user-attributes default@

    Multiple values can be specified for user-attributes and use the format key=value. These attributes are detailed in the user_attr(5) man page.

    For more information, see How to Assign Default User Attributes for LDAP Accounts.

    For a detailed description of all of the options and arguments that you can specify with the useradd command, see the useradd(8) man page.

    Note -  If you want the pam_zfs_key module to create an encrypted home directory for the user, do not specify the –m option with the useradd command. For more information, see the pam_zfs_key(7) and zfs_encrypt(8) man pages.
  3. Assign the user a password.
    # passwd username
    New password: Type user password
    Re-enter new password: Retype password

    For more command options, see the useradd(8) and passwd(1) man pages.

See Also

After creating a user, you might need to perform some additional tasks, including adding and assigning roles to a user, and displaying or changing the rights profiles of a user. For more information, see Creating a Role in Securing Users and Processes in Oracle Solaris 11.4.