Onboard two developer accounts using both minimal and fully-specified user creation workflows. Validate identity and group state, then build a shared workspace with correct group ownership before cleaning everything up safely.
You are onboarding two new developers:
devstudent and devstudent2. The team
needs a shared group called devteam and a shared
workspace at /opt/devwork owned by that group.
You will create one account using a minimal baseline workflow,
create the second using advanced useradd flags,
verify identity and group state using system files and CLI
tooling, then clean up all changes.
This is the user onboarding workflow you run when you want repeatable outcomes and clear verification, not “I think the account exists.”
/etc/passwd, id, and
/etc/group.
groupadd.
useradd (minimal and
advanced flags).
passwd.
usermod -g.
mkdir and chgrp.
grep and id.
userdel -r and groups
with groupdel.
sudo groupadd devteam
The group is the shared access boundary. Create it first so both users can be anchored to the same team identity.
# Optional verification:
getent group devteam
sudo useradd devstudent
This creates the user using system defaults (often without
creating a home directory, depending on distro defaults and
/etc/login.defs).
sudo passwd devstudent
Password assignment completes the onboarding baseline and allows interactive login (subject to policy, shell, and account state).
sudo usermod -g devteam devstudent
Primary group affects default group ownership for new files. This aligns the user with the team by default.
sudo useradd -g devteam -s /bin/bash -c "Dev employee" -m -d /home/devstudent2 devstudent2
This is the explicit, repeatable form: you define the primary group, shell, comment field, home directory path, and ensure the home directory exists immediately.
sudo passwd devstudent2
With the account created and home provisioned, password is the final access step before verification.
sudo mkdir -p /opt/devwork && sudo chgrp -R devteam /opt/devwork
This creates the directory and ensures all content under it is owned by the shared group. This is the minimum needed for controlled team collaboration.
/etc/passwd.
grep devstudent /etc/passwd
This verifies the local account record and shows UID, GID, home, and shell fields.
devstudent:x:1001:1002::/home/devstudent:/bin/bash
/etc/passwd.
grep devstudent2 /etc/passwd
devstudent2:x:1002:1002:Dev employee:/home/devstudent2:/bin/bash
devstudent.
id devstudent
uid=1001(devstudent) gid=1002(devteam) groups=1002(devteam)
devstudent2.
id devstudent2
uid=1002(devstudent2) gid=1002(devteam) groups=1002(devteam)
/etc/group.
cat /etc/group
devteam:x:1002:devstudent,devstudent2
sudo userdel -r devstudent && sudo userdel -r devstudent2 && sudo groupdel devteam
userdel -r removes the account and home
directory. Removing the group last ensures no accounts still
depend on it.
groupadd <group>
: Creates a new group.
useradd <user>
: Creates a user using system defaults.
useradd -g <group> -s <shell> -c "<comment>" -m -d <home> <user>
: Creates a user with explicit primary group, shell, comment,
and home provisioning.
passwd <user>
: Sets or changes a user password.
usermod -g <group> <user>
: Changes a user’s primary group.
chgrp -R <group> <path>
: Sets group ownership recursively.
id <user>
: Displays UID, primary GID, and supplementary groups.
/etc/passwd
: Local user account database.
/etc/group
: Local group membership database.
userdel -r <user>
: Deletes a user and removes their home directory.
groupdel <group>
: Deletes a group.