Adding members as we create their user accounts

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 cleopatra
cleopatra : 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 cleopatra

donnie@ubuntu3:~$ groups cleopatra
cleopatra : cleopatra marketing
donnie@ubuntu3:~$

And, of course, I'll need to assign Cleopatra a password in the normal manner:

[donnie@localhost ~]$ sudo passwd cleopatra
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.39.23