Add Users to Groups

New Linux users most confusing is about the files permission. Associate with file permissions is the owner and groups.
Here is how to add users to a group.

$useradd -G {group-name} username

Useradd to primary group. Example:

$useradd -g developers tony

Adding existing user to existing groups

$usermod -a -G ftp tony

-G is for adding to secondary group
-g is for changing to primary group

Source: Cyberciti.biz

Advertisements