_ _
___ | |__ __ _ _______ | |_
/ _ \| '_ \ / _` |_ / _ \| __|
| (_) | | | | (_| |/ / (_) | |_
\___/|_| |_|\__,_/___\___/ \__|
user_management —
usage and differences across
systems
| useradd |
: adds the given user. |
| adduser |
: interactive form of useradd. |
If no options are given, the user will be created without the
corresponding structure: groups, home, skel, etc.
# useradd [options]
<username>
The following are common options that apply both to OpenBSD and Slackware.
| -b <dir> |
: base directory where the user home will be created if -m is
specified. |
|
Can be omitted, the default is /home. |
| -g <gid|name> |
: default group. |
| -d <dir> |
: home directory. If -m is specified and the directory does not
exist. |
|
Can be omitted, the default is
/home/<username>. |
| -s <shell> |
: set default login shell. |
|
Can be omitted, the default will be the system default
shell. |
| -G <g1,g2...> |
: secondary groups. |
| -m |
: Create home directory if it does not exist. If it exists, the user
creation fails. |
|
If omitted and the home directory does not exist, user
creation will fail. |
To create users that do not need a login session, for example daemons, the
following options are commonly used:
| -d |
: /dev/null |
| -s |
: /bin/false |
The option -p <password> can be used to set a password. However to ensure
security, after creation the following command can be used to set a password:
# passwd
<username>
| Slackware |
: usermod -a -G group user |
: appends the group to the user groups. |
| OpenBSD |
: usermod -G group user |
: appends user to group. |
| AlpineLinux |
: adduser user group |
: adds user to group. |
(back to top)
| - check safe cross-platform generic options. |
| - Translate to Spanish. |
(back to top)
| 2026-07-11 |
: Added useradd options and usage. |
| 2026-03-26 |
: Created. |