Home > Linux > Linux Users Management

Show user list
cat /etc/passwd

Show user's group
id USER_NAME

Add user
adduser USER_NAME

Add group
groupadd GROUP_NAME

Assign user to a primary group (Require re-login to apply the new group)
usermod -g GROUP_NAME USER_NAME

Assign user to a secondary group
usermod -a -G GROUP_NAME USER_NAME

Turn on setgid bit (all new files and subdirectories created within the current directory inherit the group ID of the directory, rather than the primary group ID of the user who created the file)
chmod g+s .

Turn off setgid bit
chmod g-s .

Check if setgid is on
ls .
(If it is on, the group permission will become rws instead of rwx)



Flag Counter