Need to grant specific permissions to a user on your Linux system? Adding them to a group is the answer! It's a simple yet powerful way to manage access rights without individually configuring each user.
The most common command is `sudo usermod -a -G <groupname> <username>`. Let's break it down:
* `sudo`: Executes the command with administrative privileges.
* `usermod`: The command for modifying user accounts.
* `-a`: Crucially, this *appends* the user to the group. Without it, you'll *replace* their existing group memberships!
* `-G`: Specifies the group(s) you want to add the user to. Separate multiple groups with commas (e.g., `-G group1,group2`).
* `<groupname>`: The name of the group you're adding the user to (e.g., 'wheel', 'www-data').
* `<username>`: The username of the account you want to modify.
For example, to add the user 'john' to the 'www-data' group, you'd run: `sudo usermod -a -G www-data john`.
After running the command, the user usually needs to log out and back in for the changes to take effect. Now go forth and conquer those permissions!