February 2020
Intermediate to advanced
666 pages
15h 45m
English
First, we can add members to the group as we create their user accounts, using the -G option of useradd. On Red Hat or CentOS, the command would look like this:
[donnie@localhost ~]$ sudo useradd -G marketing cleopatra[sudo] password for donnie:[donnie@localhost ~]$ groups cleopatracleopatra : cleopatra marketing[donnie@localhost ~]$
On Debian/Ubuntu, the command would look like this:
donnie@ubuntu3:~$ sudo useradd -m -d /home/cleopatra -s /bin/bash -G marketing cleopatradonnie@ubuntu3:~$ groups cleopatracleopatra : cleopatra marketingdonnie@ubuntu3:~$
And, of course, I'll need to assign Cleopatra a password in the normal manner:
[donnie@localhost ~]$ sudo passwd cleopatra