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