[Linux] User management in Linux
Here is a summary of commands for user management in Linux.
-
see all existing groups
1
getent group
-
get all groups a user belongs to
1
groups username
-
create a new group
1
sudo groupadd new_group
-
add user to a group
1 2 3
sudo adduser username groupname # or sudo usermod -aG groupname username
-
create a new user
1 2 3
sudo adduser username # this also create a new group `username` # to create a new user only in an existing group, do sudo useradd -G groupname newusername
To be updated in the future.
Happy programming. 😄
Last modified on 2023-05-28