Adding Accounts

Sun offers several authentication methods for logging in. The most basic is the "files" method which uses /etc/passwd, /etc/shadow, and /etc/group. More sophisticated network versions use NIS, NIS+, LDAP, or other proprietary network based authentication processes. These are used in a corporate environement and beyond the scope of these pages.

Sun offers several tools for adding accounts. The best of these run under CDE or open windows. Account names can be 1 - 8 alphanumeric characters. If other family members will be using this machine, you can set up separate accounts for them. Accounts also have a UID (User ID) number and a GID (Group ID) number. This is what Solaris and other UNIX based systems use internally to keep track of who you are and what files you own. The super user, root, is UID 0. When add an account, you can choose the UID number or let the system pick it for you. If you have more than one Sun machine on your network, it is useful to use the same UID on each machine. This way, if you NFS mount a disk on one machine from another, files owned by you on the remote machine are still owned by you across the NFS mount. You can find the UID on an existing acount by running the command: id at the UNIX promptThe output will look like:

uid=727(stymar) gid=358(ce)

Adding an Account Using the Direct Approach (Edit the Files)

The is some advantage in knowing how to add an account using the direct approach. You know a list of places to look if there is trouble. You need to perform the following actions to create an account by editing files:

  1. /etc/passwd
    Add a line of the form:
    stymar:x:727:10:Bob Styma:/export/home/stymar:/usr/bin/ksh
    The fields are separated by colons and are:
    1. stymar - This is the userid, put your userid here
    2. x - Flag which says use /etc/shadow to get the encrypted password
    3. 727 - The userid (take from id command you ran at work
    4. 10 - Group "Staff" found in /etc/group
    5. Bob Styma - Your full name
    6. /export/home/stymar - Your home directory
    7. /usr/bin/ksh - The shell you run

     

  2. /etc/shadow
    Add a line of the form:
    stymar:::::::
    This specifies that the userid stymar exists and has no password. You will be able to set a password when you are logged in. See the manual page for what all the other fields mean.

     

  3. Create the Home Directory as root:
    Execute the commands:
    mkdir /export/home/stymar
    chown stymar /export/home/stymar
    chgrp staff /export/home/stymar
    chmod 755 /export/home/stymar

You now have an empty account set up. In all cases, replace stymar by your userid. You may want to set up a custom .profile, .dtprofile, and .kshrc file for the account.


Adding an Account Using the Solaris useradd Command

The solaris useradd(1m) command peforms all the above function with the exception of poplulating the home directory (which it can do given a template) and setting the password. This command has to be run as root. This is probably the easiest and most common way to add local accounts. More on adding accounts

Sample:

useradd -c "Cathy Styma" -m -d /home/stymac -u 714 -s /usr/bin/ksh stymac
 
passwd stymac

Adding an Account Using the Solaris admintool GUI

Admintool has been replaced in Solaris 10 by /usr/sbin/smc (Solaris Management Console). However older versions of Solaris still have the admintool command.

Accounts can be added on the Sun using the graphical user interface (GUI) tool admintool. When the tool first comes up it displays a list of the accounts known in the /etc/passwd file.

Run /usrbin/admintool from the command line to bring up the main admintool menu shown below. From the Edit pulldown option, select Add to bring up the add dialog. Fill in the userid, uid, Comment (user full name) and the home directory. Use the pulldown to change the Password type to Normal Password... When you do this, you will be prompted for the password for the user. Enter the password for the account a press enter. Then in the add dialog, press Apply to create the account.

Admin Tool Add Menu
Admin Tool Add Dialog Admin Tool Password Dialog Box


Back to Sun At Home Home Page
Last Maintained, 10/28/2010 by R. E. Styma