How can new users and user groups be created in Linux?
New users and user groups can be created in Linux by following these steps:
- Create a new user group:
sudo groupadd <group_name>
- Create a new user and assign them to a specific group.
sudo useradd -m -g <group_name> <username>
Please note that the -m option is used to create a user’s home directory, while the -g option is used to specify the user’s group. After creating the user, you can use the passwd command to set a password for the user.
sudo passwd <username>
Furthermore, you can also use the usermod command to modify a user’s properties, such as changing the user’s group.
sudo usermod -g <new_group_name> <username>