Linux users and groups
Groups
List all groups
cat /etc/group
Create new group
https://linux.die.net/man/8/groupadd
groupadd mygroup
Use -f
to exit successfully if the group already exists.
Users
List all users
cat /etc/passwd
Create new user
useradd -g GROUP -d HOMEDIR USERNAME
Will fail if GROUP does not exist yet.
Print a user’s home directory
echo ~username
Print user information
id -u tomcat
Print all files owned by a user
find / -user tomcat -print
Delete a user and the user’s home directory
userdel -r tomcat"