From dd7e7f6f916eee73e8d4eca86019ccb07474bc02 Mon Sep 17 00:00:00 2001 From: RealStickman Date: Sun, 24 Apr 2022 15:01:06 +0200 Subject: [PATCH] (Grav GitSync) Automatic Commit from RealStickman --- .../03.users-and-groups/default.en.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pages/02.linux/03.users-and-groups/default.en.md diff --git a/pages/02.linux/03.users-and-groups/default.en.md b/pages/02.linux/03.users-and-groups/default.en.md new file mode 100644 index 0000000..c392126 --- /dev/null +++ b/pages/02.linux/03.users-and-groups/default.en.md @@ -0,0 +1,45 @@ +--- +title: 'Users and Groups' +--- + +## Users + +Check users by looking at `/etc/passwd` + +### Add users +Basic usage: +`# useradd -m (user)` + +Important options: +``` +login name -> by default +group -> -G //separate multiple by commas: group1,group2 +with home dir -> -m +shell -> -s +full name -> -c +``` + +Example more complicated usage: +`# useradd -m -c "Bruno Huber" -s /bin/bash -G buchhaltung,sudo bruhub` + +### Add user to groups +Add user to more groups: +`# usermod -a -G (group1),(group2) (user)` + +Alternative command: +`# gpasswd -a (user) (group)` + +### Remove user from group +`# gpasswd -d (user) (group)` + +## Groups +Check a user's groups with `id (user)` + +### Create group +`# groupadd (group)` + +### Rename group +`# groupmod -n (new_group) (old_group)` + +### Delete group +`# groupdel (group)`