Creating an Account on the command line

Creating the Group

To create the group there are several was to do this. The following is using the dscl command

   saturn:~ root# dscl . create /groups/lhw gid 1180
   saturn:~ root# dscl . create /groups/lhw passwd '*'
   saturn:~ root#

Using the niload command:

    saturn:~ root#  niload group .  << EOF
    > lhw:*:1180:
    > <CTRL-D>
    saturn:~ root#

Now check to see if the new entry exists.

    saturn:~ root# nidump group . | grep lhw
    lhw:*:1180:

Creating the User

Creation of the user could be done with a series of dscl commands adding each componet of the account. But
the niload provides a single line entry

    saturn:~ root# niload passwd . << EOF
    > lhw:*:1018:1180::0:0:Lawrence H. Wasserman:/Users/lhw:/bin/tcsh
    > <CRTL-D>
    saturn:~ root#

Now check to see if the new entry exists

   saturn:/Users root# nidump passwd . | grep lhw
   lhw:********:1018:1180::0:0:Lawrence H. Wasserman:/Users/lhw:/bin/tcsh
   saturn:/Users root#

Change the password

Once the user is created change the password to something to pass on to the user:

    saturn:~ root# passwd lhw
    Changing password for lhw.
    New password:<ChangeMe>
    Retype new password:<ChangeMe>
    saturn:~ root#

Create the Home Directory

Now Make the directory and change the ownership:

   saturn:/Users root# mkdir /Users/lhw
   saturn:/Users root#  chown -R lhw:lhw /Users/lhw

-- Main.BrianWTaylor - 25 May 2006

  • No labels