Users in Linux
List of all Linux users
The list of users is stored in the file
passwd
in
/etc/
To open it, execute
cat /etc/passwd
Create a user
To create the user user1, enter the command
adduser user1
If you got the message bash: adduser: command not found read the solution here
Delete a user
If you get tired of a user, you can delete them with the command
deluser user1
Change the user password
If you forget the password of a user, you can change it as root with the command
passwd user1
List of groups
Find out which groups the user user1 belongs to
groups user1
Add the user user1 to the group group1
usermod -G group1 user1
Add the user sinij to both the group group1 and the group bks_fans
usermod -G group1,bks_fans sinij
Change the primary group of the user user1 to group2 (by default the group is usually named the same as the user)
usermod -g group2 user1
Get the list of all groups
cat /etc/group
To get not the whole list but only regular user groups
cat /etc/group | grep 1[0-9][0-9][0-9]
You can read about grep and other commands here
Change the group that owns the directory /home/movies to users
chgrp -R users /home/movies
Article author: Andrei Olegovich