2025-03-14 21:59:59 -06:00
|
|
|
# useradd
|
|
|
|
|
|
|
|
|
|
> Create a new user.
|
|
|
|
|
> See also: `users`, `userdel`, `usermod`.
|
|
|
|
|
> More information: <https://manned.org/useradd>.
|
|
|
|
|
|
|
|
|
|
- Create a new user:
|
|
|
|
|
|
|
|
|
|
`sudo useradd {{username}}`
|
|
|
|
|
|
|
|
|
|
- Create a new user with the specified user ID:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`sudo useradd {{[-u|--uid]}} {{id}} {{username}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Create a new user with the specified shell:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`sudo useradd {{[-s|--shell]}} {{path/to/shell}} {{username}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Create a new user belonging to additional groups (mind the lack of whitespace):
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`sudo useradd {{[-G|--groups]}} {{group1,group2,...}} {{username}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Create a new user with the default home directory:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`sudo useradd {{[-m|--create-home]}} {{username}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Create a new user with the home directory filled by template directory files:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`sudo useradd {{[-k|--skel]}} {{path/to/template_directory}} {{[-m|--create-home]}} {{username}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Create a new system user without the home directory:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`sudo useradd {{[-r|--system]}} {{username}}`
|