chmod. The objective is not just to run commands, but to understand how each change affects access control so you can enforce proper policies on a Linux system.

- Create users and groups, and add users to a group.
- Change ownership with
chown(including-Rfor recursion). - Set permissions with numeric
chmod(e.g.,640) and symbolicchmod(e.g.,g+w,o-rwx). - Verify results with
ls -l.
Numeric permission shorthand: 6 = read+write (rw), 4 = read (r), 2 = write (w), 1 = execute (x), 0 = no permissions. Example:
640 → owner rw (6), group r (4), others - (0).- You will run the commands as root (prompt shown as
root@control:/#). If you are not root, prefix admin commands withsudo. - Basic familiarity with the shell and
ls -loutput is helpful.
- We created three accounts:
dev1,dev2, andmanager. - We created a shared group
devteamand appendeddev1anddev2to it usingusermod -aG, which preserves existing group memberships.
chown dev1:devteam /project/app.confassigns the file owner todev1and group todevteam.ls -lconfirms owner and group:dev1 devteam.
chmod 640):
chmod 640sets owner =rw(6), group =r(4), others =-(0). Thels -lpermission display shows-rw-r-----.
- When
app2.confwas created, defaults gave it ownerroot:root. chown -R dev1:devteam /projectrecursively changes owner and group for the directory and its contents todev1:devteam.
/project/app.conf using symbolic chmod:
chmod g+wadds write permission for the group without changing owner or other bits.app.confnow shows-rw-rw----(ownerrw, grouprw, others-) which corresponds to numeric660.
chmod o-rwxremoves read, write, and execute bits from others. If others already had no permissions, the state remains unchanged.
Commands summary
Best practices and warnings
Use
chown -R and recursive chmod with care — they can change ownership/permissions for many files at once. Double-check the target path to avoid inadvertently changing system or unrelated files.man chmod— https://man7.org/linux/man-pages/man1/chmod.1.htmlman chown— https://man7.org/linux/man-pages/man1/chown.1.html- Practical guide on Linux file permissions — https://www.digitalocean.com/community/tutorials/understanding-linux-file-permissions
- Created users and a shared group, then added users to that group.
- Created files, set ownership with
chownandchown -R. - Used numeric
chmod(e.g.,640) to explicitly set owner/group/others bits. - Used symbolic
chmod(g+w,o-rwx) to tweak permission classes without altering other bits. - Verified each step with
ls -lto confirm ownership and permissions.