>_ IzzyLab

Hands-on task

This task is step 23 of the course “Users, groups and permissions”

Remove world-write access in the shared folder

medium~5 min

Before an audit, check the team's shared folder /srv/team: some files (in subdirectories too) are writable by everyone. Remove the write bit for "others" from all such files without changing the owner and group permissions — the group must keep write access where it had it.

What you'll practise:
  • find -perm
  • world-writable
  • chmod o-w
  • symbolic permissions
  • audit

Topic breakdown

A file writable by everyone (the w bit for "others") can be replaced by any user on the system — so such files are looked for in every audit. find selects objects by permission bits: a mask with the - prefix means "all the listed bits are set", which lets you pick out exactly the world-writable files whatever their other permissions are. Removing a single bit without touching the rest is what the symbolic form of chmod does; the numeric form would overwrite the whole mode and take away from the group what it's entitled to.

What's checked

  1. no world-writable files left
  2. owner and group permissions unchanged

What it looks like