###Introduction###

Creating user accounts on OpenBSD can be done either using the **adduser** script or the **useradd** program.

Here is an example of using the **adduser** script.

""#**adduser**

     Use option ``-silent'' if you don't want to see all warnings and questions.

     Reading /etc/shells
     /etc/master.passwd
     Check /etc/group

     Ok, let's go.
     Don't worry about mistakes. There will be a chance later to correct any input.

     Enter username []: sij
     Enter full name []: Siju Oommen George
     Enter shell csh ksh nologin sh [ksh]: csh
     Uid [1001]: 
     Login group sij [sij]: 
     Login group is ``sij''. 
     Invite sij into other groups: guest no 
     [no]: wheel
     Login class authpf daemon default staff [default]: 
     Enter password []: 
     Enter password again []: 

     Name:        sij
     Password:    ****
     Fullname:    Siju Oommen George
     Uid:         1001
     Gid:         1001 (sij)
     Groups:      sij wheel
     Login Class: default
     HOME:        /home/sij
     Shell:       /bin/csh
     OK? (y/n) [y]: 
     Added user ``sij''
     Copy files from /etc/skel to /home/sij
     Add another user? (y/n) [y]: n
     Goodbye!

The default answers are always given in brackets so just press **Enter** to choose the default.
In the given example we did not specify a **Uid** the system automatically selects the next assignable one. If required you can provide your own **Uid**.
The password is not echoed as one types. After you create a user account like this you can see the corresponding entry in **/etc/passwd**
It will look like this.

""**sij:*:1001:1001:Siju Oommen George:/home/sij:/bin/csh**

You can also see a corresponding entry in **/etc/master.passwd** that lookes like.

""**sij:$2a$06$pVJNK8aa76rg4PZHYeHJ/.U.H1l3VqcQgUQ3y7pzlcq7Kx/odpEiG:1001:1001::0:0:Siju Oommen George:/home/sij:/bin/csh**

where $2a$06$pVJNK8aa76rg4PZHYeHJ/.U.H1l3VqcQgUQ3y7pzlcq7Kx/odpEiG is the encrypted password.

This will also create a group called **sij** in **/etc/group** and add user **sij** to the **wheel** group.

""**wheel:*:0:root,sgeorge,sij**

""**sij:*:1001:**

Additional options and how to use them can be got from

""#**man adduser**

Now we will look at how we can use **useradd** to create an account.

""#**useradd -D**
     group           users
     base_dir        /home
     skel_dir        /etc/skel
     shell           /bin/ksh
     class           
     inactive        Null (unset)
     expire          Null (unset)
     range           1000..60000

The above command shows the defaults **useradd** will use if they are not over ridden while using command.
To over ride values just specify them while using the command.
For example to over ride the shell type:

""#**useradd -m -s /bin/sh sij1**

This will create user **sij1** as you can see in **/etc/passwd**

""**sij1:*:1002:1001::/home/sij1:/bin/sh**

 and in **/etc/master.passwd**

""**sij1:*************:1002:1001::0:0::/home/sij1:/bin/sh**

The password field is filled with ************* because the user is not assigned with a password. The account remains disabled until the user is assigned with a password. The **passwd** utility can be used to assign password for the user.

""#**passwd sij1**
     Changing local password for sij1.
     New password:
     Retype new password:

The password will not echo. Now you can see the password field in **/etc/master.passwd** has the encrypted password.

""**sij1:$2a$06$b0WIJdi/DNDOdGa9oRicm.fAHOkZEiT7HWhpzT3LMoPbs6dEk9nRe:1002:1001::0:0::/home/sij1:/bin/sh**

The password can also be set using the **-p** option while using **useradd**

The **-m** is used to create the user's home directory.

More options and how to use then can be found by

""#**man useradd**

The **/etc/passwd** file can be safely edited by using the **vipw** utility.

""#**vipw**

 **vipw** by defauls opens **/etc/passwd** for editing in the **vi** editor after the file is modified **vipw** performs a number of consistency checks on the password entries, and will not allow a password file with a ``mangled'' entry to be installed. If **vipw** rejects the new password file, the user is prompted to re-enter the edit session.


Deleting a user account on OpenBSD is done using the **userdel** command. To remove the user **sij** type.

""#**userdel sij**

This does not remove the user's home directory. In order to remove the home directory also use the **-r** option with **userdel**

""#**userdel -r sij**

