# Creating a System User (like www)



## vask (Feb 10, 2009)

adduser is simple enough but I am unsure about what information to put when adding another user with the same privileges as www

I have looked at the following but still need help:
http://www.freebsd.org/doc/en/books/handbook/users.html

Basically I want to clone the www user with a different name but am unsure of all the settings used.  So far I have:


```
# adduser
Username: wwwmain
Full name: Apache User for User main
Uid (Leave empty for default): 
Login group [wwwmain]: 
Login group is wwwmain. Invite wwwmain into other groups? []: main
Login class [default]: 
Shell (sh csh tcsh bash rbash nologin) [sh]: nologin
Home directory [/home/wwwmain]: /nonexistent
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]: 
Username   : wwwmain
Password   : <disabled>
Full Name  : Apache User for User main
Uid        : 1015
Class      : 
Groups     : wwwmain main
Home       : /nonexistent
Shell      : /usr/sbin/nologin
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (wwwmain) to the user database.
```

Does this look ok?

And what does the following mean when I respond with no:
Use password-based authentication? [yes]: no


----------



## SirDice (Feb 11, 2009)

It looks fine.. You may also want to check out man pw.


```
pw adduser wwwmain -g wwwmain -d /nonexistent -s /usr/sbin/nologin -c "Apache user for user main"
```


----------



## fronclynne (Feb 12, 2009)

+1 to learning pw(1)


----------



## theDave (Nov 9, 2017)

Eight years later, +1 to learning pw.


----------



## poorandunlucky (Nov 11, 2017)

try vipw(8).

just go over the line you want to copy, type `yy`, then `p`, then press `i` to edit, when you're done press `escape`, and enter `:wq` to write and quit!

simple..


----------



## HL1234 (Nov 11, 2017)

SirDice said:


> It looks fine.. You may also want to check out man pw.
> 
> 
> ```
> ...


group "wwwmain" have to add before; see my test and error

`pw adduser wwwmain -g wwwmain -d /nonexistent -s /usr/sbin/nologin -c "Apache user for user main" -N
pw: group `wwwmain' does not exist`
`pw addgroup help`
That should be done before:
`pw addgroup -n wwwmain`


----------



## poorandunlucky (Nov 11, 2017)

Seriously, I just use vi (which you _really_ should know if you use any kind of 'nix system, from BusyBox to, well, FreeBSD, imo)...

`echo "groupname:*:65535:username,username" >> /etc/group

adduser

(follow prompts)

or

vipw

(modify text file)`

It's really not that complicated...  In fact, vi is kind of elegant...  It's enjoyable to use, and surprisingly fit for its common tasks...


----------



## HL1234 (Nov 18, 2017)

your are right, `vipw` can be easier than `adduser`.
But you have edit it interactive. When you will write a script or just change some with one command line, and you want document also what you have been done, `pw ...` is better for that.
thanks.


----------



## rgacote (Sep 2, 2020)

HL1234 said:


> group "wwwmain" have to add before; see my test and error
> 
> `pw adduser wwwmain -g wwwmain -d /nonexistent -s /usr/sbin/nologin -c "Apache user for user main" -N
> pw: group `wwwmain' does not exist`
> ...



You can just leave off the -g parameter. pw creates the default group with the same name (at least on 12.1)
`pw adduser wwwmain  -d /nonexistent -s /usr/sbin/nologin -c "Apache user for user main"`


----------

