>_ IzzyLab

Hands-on task

This task is step 2 of the course “New server: setup from scratch”

A site directory for the team

medium~10 min

A team is going to work on the shop website. Create the group shopteam, the user kate with a home directory and membership in that group, and the directory /srv/shop: owner kate, group shopteam, permissions 770 — the team reads and writes, everyone else is locked out.

What you'll practise:
  • groupadd
  • useradd -G
  • chown owner:group
  • chmod 770
  • group access

Topic breakdown

Linux permissions come in three classes: owner, group and others. A "team" directory is built exactly on them: the owner is a specific person, the group is the team, and "others" get nothing. A group is created with groupadd, a user with a home directory and group membership with useradd (an existing user is extended with usermod -a -G so as not to lose their previous groups). The directory owner and group are set by chown owner:group, octal permissions by chmod (7 = rwx, 0 = nothing). The result is easy to check with stat -c '%U %G %a'.

What's checked

  1. group shopteam created
  2. kate is a member of shopteam
  3. kate has a home directory
  4. /srv/shop belongs to kate:shopteam with permissions 770

What it looks like