Add New User in Solaris

Bismillahirrahmanirrahim…

You must be root (superuser) to add a user. An easy way to remember the syntax of the useradd command in Solaris is to run it with no options. Follow the resulting usage information including the parts that you require. Important options are:

-d home-directory-path
This is the new user’s home directory, typically /export/home/username

-m
make home directory and copy the default skeleton files (these files are located in /etc/skel directory).

-u uid
The uid (userid) is a number from 0 to 65535 which identifies the user on the system. uid 0 is reserved for root. If you don’t specify one, the next available uid will be used automatically.

-c “User Name”
Comment field which usually contains the name of the user. Make sure you enclose the name in quotes if it contains a space.

-s /path/to/shell
The shell to use. If you don’t specify this, it will default to /bin/sh. Make sure you specify the fully qualified path.

So, putting it together, a typical addition of a user named fred would be:

# useradd -d /export/home/hanief -m -s /bin/ksh -c “Hanief Harun” hanief

Now set the password for this user
# passwd hanief

then set ownership for dir /export/home/hanief
# chown -R /export/home/hanief

It’s a smart idea to run pwck (passwd check) whenever you make a change to the /etc/passwd file (as when adding or changing a user). This program will identify any problems with the passwd file. If it doesn’t tell you anything, then you are in good shape.

ref:

  • http://www-01.ibm.com/support/knowledgecenter/SSGSG7_7.1.1/com.ibm.itsm.srv.install.doc/t_srv_inst_create_dirsid-solaris.html
  • http://www.tech-recipes.com/rx/16/add-a-user-from-the-command-line-in-solaris/
  •  

    wassalam..

    Advertisements
    This entry was posted in Solaris and tagged . Bookmark the permalink.

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s