How to change a user's primary group?

To change a user's primary group in Linux, you can use the usermod command. Here’s the syntax:

sudo usermod -g new_primary_group username

Replace new_primary_group with the name of the new primary group you want to assign, and username with the actual username of the user.

For example, to change the primary group of user "jack" to "developers," you would run:

sudo usermod -g developers jack

After executing this command, you can verify the change by using:

id jack

This will show the new primary group for "jack." If you have any further questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!