How to create user account in Solaris

If you’re coming from Linux flavor, you might notice creating user account in Solaris slightly different as you need to provide few options as this is commonly ignored in Linux.

useradd [-c comment] [-d dir] -m [-g group] -s /bin/bash <login_name>

-c comment
Any text string. It is generally a short description of the login. Please put the user’s full name.

-d dir
The home directory of the new user. Usually the directory is /export/

-g group
New user’s primary group membership. We can get the group name from /etc/group file.

Below is the sample command to create the Unix account called “prdadmin”.

root@server:/# useradd -c "System Administrator" -d /export/prdadmin -m -g sysadmin -s /bin/bash prdadmin

After account is created, we need to create the password using the “passwd” command.

root@server:/# passwd prdadmin