2014-03-24 10:31:06 +00:00
|
|
|
# usermod
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Modifies a user account.
|
2022-01-27 21:08:33 +00:00
|
|
|
> See also: `users`, `useradd`, `userdel`.
|
2021-04-17 13:19:41 +01:00
|
|
|
> More information: <https://manned.org/usermod>.
|
2014-03-24 10:31:06 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
- Change a username:
|
2014-03-24 10:31:06 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
`sudo usermod --login {{new_username}} {{username}}`
|
2014-03-24 10:31:06 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
- Change a user id:
|
2014-03-24 10:31:06 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
`sudo usermod --uid {{id}} {{username}}`
|
2014-03-24 10:31:06 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
- Change a user shell:
|
2014-03-24 10:31:06 +00:00
|
|
|
|
2022-01-27 21:08:33 +00:00
|
|
|
`sudo usermod --shell {{path/to/shell}} {{username}}`
|
|
|
|
|
|
|
|
- Add a user to supplementary groups (mind the lack of whitespace):
|
|
|
|
|
|
|
|
`sudo usermod --append --groups {{group1,group2,...}} {{username}}`
|
|
|
|
|
|
|
|
- Change a user home directory:
|
|
|
|
|
|
|
|
`sudo usermod --move-home --home {{path/to/new_home}} {{username}}`
|