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:

  1. Create a new user group:
sudo groupadd <group_name>
  1. 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>
Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds