2014-03-23 23:45:45 +00:00
|
|
|
# useradd
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Create a new user.
|
2022-01-27 21:08:33 +00:00
|
|
|
> See also: `users`, `userdel`, `usermod`.
|
2021-04-17 13:19:41 +01:00
|
|
|
> More information: <https://manned.org/useradd>.
|
2014-03-23 23:45:45 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
- Create a new user:
|
2014-03-23 23:45:45 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
`sudo useradd {{username}}`
|
2014-03-23 23:45:45 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
- Create a new user with the specified user id:
|
2014-03-23 23:45:45 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
`sudo useradd --uid {{id}} {{username}}`
|
2014-03-23 23:45:45 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
- Create a new user with the specified shell:
|
2014-03-23 23:45:45 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
`sudo useradd --shell {{path/to/shell}} {{username}}`
|
2014-03-23 23:45:45 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
- Create a new user belonging to additional groups (mind the lack of whitespace):
|
2014-03-23 23:45:45 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
`sudo useradd --groups {{group1,group2,...}} {{username}}`
|
2016-09-10 10:45:36 +01:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
- Create a new user with the default home directory:
|
2016-09-10 10:45:36 +01:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
`sudo useradd --create-home {{username}}`
|
|
|
|
|
|
|
|
- Create a new user with the home directory filled by template directory files:
|
|
|
|
|
|
|
|
`sudo useradd --skel {{path/to/template_directory}} --create-home {{username}}`
|
|
|
|
|
|
|
|
- Create a new system user without the home directory:
|
|
|
|
|
|
|
|
`sudo useradd --system {{username}}`
|