I know that to add a group in Ubuntu I use the command groupadd and to add a use
ID: 3676756 • Letter: I
Question
I know that to add a group in Ubuntu I use the command groupadd and to add a user to that group I use useradd. I am having trouble understanding how to do the attributes the way it is asking.
Part 1: User and Group Creation
“sudo su -“
Create 3 new groups:
cs
math
science
Create 2 new users named “steve” and “lucy” with the following attributes:
default shell is /bin/bash
comment (GECOS) field contains full names (Steve Smith / Lucy Goosey)
steve primary group = math additional group = science
lucy primary group = cs additional group = science
Make your own account members of all three groups.
Explanation / Answer
Creating a group
sudo addgroup CS
sudo addgroup Math
sudo addgroup Science
Creating a user into this group
sudo SteveSmith Science
sudo LucyGoosey Science
If you want to set the primary group for a user, then you can type
sudo usermod –g Science SteveSmith
sudo usermod –g Science LucyGoosey
If you want your user to be member of multiple groups you can use
sudo usermod –G Math,Science SteveSmith
sudo usermod –G CS,Science LucyGoosey
Note : the ‘–G’(caps)
To keep a comment you can use