diff --git a/pages/common/users.md b/pages/common/users.md index b6339a242..9ed751254 100644 --- a/pages/common/users.md +++ b/pages/common/users.md @@ -1,12 +1,13 @@ # users > Display a list of logged in users. +> See also: `useradd`, `userdel`, `usermod`. > More information: . -- Display a list of logged in users: +- Print logged in usernames: `users` -- Display a list of logged in users according to a specific file: +- Print logged in usernames according to a given file: `users {{/var/log/wmtp}}` diff --git a/pages/linux/useradd.md b/pages/linux/useradd.md index ea7ff6ca2..a3e917e8f 100644 --- a/pages/linux/useradd.md +++ b/pages/linux/useradd.md @@ -1,24 +1,33 @@ # useradd > Create a new user. +> See also: `users`, `userdel`, `usermod`. > More information: . -- Create new user: +- Create a new user: -`useradd {{name}}` +`sudo useradd {{username}}` -- Create new user with a default home directory: +- Create a new user with the specified user id: -`useradd --create-home {{name}}` +`sudo useradd --uid {{id}} {{username}}` -- Create new user with specified shell: +- Create a new user with the specified shell: -`useradd --shell {{path/to/shell}} {{name}}` +`sudo useradd --shell {{path/to/shell}} {{username}}` -- Create new user belonging to additional groups (mind the lack of whitespace): +- Create a new user belonging to additional groups (mind the lack of whitespace): -`useradd --groups {{group1,group2}} {{name}}` +`sudo useradd --groups {{group1,group2,...}} {{username}}` -- Create new system user without a home directory: +- Create a new user with the default home directory: -`useradd --no-create-home --system {{name}}` +`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}}` diff --git a/pages/linux/userdel.md b/pages/linux/userdel.md index 9041ce638..89763c984 100644 --- a/pages/linux/userdel.md +++ b/pages/linux/userdel.md @@ -1,21 +1,17 @@ # userdel > Remove a user account or remove a user from a group. -> Note: all commands must be executed as root. +> See also: `users`, `useradd`, `usermod`. > More information: . - Remove a user: -`userdel {{name}}` - -- Remove a user along with their home directory and mail spool: - -`userdel --remove {{name}}` - -- Remove a user from a group: - -`userdel {{name}} {{group}}` +`sudo userdel {{username}}` - Remove a user in other root directory: -`userdel --root {{path/to/other/root}} {{name}}` +`sudo userdel --root {{path/to/other/root}} {{username}}` + +- Remove a user along with the home directory and mail spool: + +`sudo userdel --remove {{username}}` diff --git a/pages/linux/usermod.md b/pages/linux/usermod.md index 41d2a35e2..a712fec29 100644 --- a/pages/linux/usermod.md +++ b/pages/linux/usermod.md @@ -1,16 +1,25 @@ # usermod > Modifies a user account. +> See also: `users`, `useradd`, `userdel`. > More information: . -- Change a user's name: +- Change a username: -`usermod -l {{newname}} {{user}}` +`sudo usermod --login {{new_username}} {{username}}` -- Add user to supplementary groups (mind the whitespace): +- Change a user id: -`usermod -a -G {{group1,group2}} {{user}}` +`sudo usermod --uid {{id}} {{username}}` -- Create a new home directory for a user and move their files to it: +- Change a user shell: -`usermod -m -d {{path/to/home}} {{user}}` +`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}}`