LICM study materials
LICM study resources

Shared Design Folder, Umask, and a Read-Only Contractor

LICM · Put your knowledge to work in context.

All case studies

Shared Design Folder, Umask, and a Read-Only Contractor

A five-person graphic design team shares a Linux file server. All designers are members of the design group; the shared folder is /srv/design, owned by root:design with mode 2775, and it has worked for months. A new designer, Mina, joins. She can enter the folder and create files, but when she opens a file created by a colleague, she gets 'Permission denied' when saving changes; files created by others show mode -rw-r--r--. The team's login umask is 0022. The studio also hires a temporary contractor, Raj, who needs to read all design files for two weeks but must not change or delete anything. The owner asks you to fix collaboration and give Raj access without adding him to the design group permanently, because group membership would also give him write access to other projects.

1. Explain why Mina cannot edit colleagues' files and describe the smallest safe set of changes to make new and existing files group-editable. Include commands and the role of umask and the setgid bit.

Read the worked answer

Mina can create files because the directory is group-writable (2775), but the files themselves are created with mode 644: the process umask 022 strips group write. Group ownership is correct thanks to the setgid bit on /srv/design (the leading 2), which makes new entries inherit the design group, but setgid does not grant permissions. Fix the default for designers by setting umask 002 in a profile file that only the design team reads, or more robustly use a default ACL. For existing content: find /srv/design -type d -exec chmod 2775 {} + and find /srv/design -type f -exec chmod 664 {} +. Applying chmod -R g+rw alone can add execute to files and remove the setgid bit if you are careless; the find split preserves directory setgid and avoids making files executable. Verify with ls -ld /srv/design, ls -l on a sample, and getfacl. A default ACL such as setfacl -d -m g:design:rwx /srv/design makes new files group-writable regardless of the creator's umask, but the ACL mask must allow it; check getfacl for mask::rwx. Avoid 777: it gives every local account write access and lets a compromised process alter designs.

2. Give Raj read-only access for two weeks without group membership. Compare adding him to the design group, a bind mount, and POSIX ACLs; recommend one and give the commands. How do you ensure new files are also readable?

Read the worked answer

Adding Raj to design is the wrong tool: group membership is global to the host, persists after two weeks unless someone remembers to remove it, and grants whatever the group can do elsewhere, including write. A bind mount or a second copy is heavier and can drift out of sync; a copy also duplicates possibly licensed artwork. POSIX ACLs are the right fit. Apply a recursive read-only ACL: setfacl -R -m u:raj:rX /srv/design. rX means read on files and execute/traverse only on directories, so Raj can list and open files but cannot create, modify, or delete. Add a default ACL so new files are covered: setfacl -d -m u:raj:rX /srv/design. Check getfacl /srv/design and a sample file; the mask:: entry must include r for Raj's effective permission to allow reads, and if files are mode 660 the mask may need adjustment. Do not give Raj the group. At the end of two weeks, remove with setfacl -R -x u:raj /srv/design and remove the default entry. Document the dates, and if Samba exports the share, confirm the share's own permissions do not override the ACL.

3. The owner asks whether `chmod -R 777 /srv/design` would be simpler. Explain the risks and give one command to audit world-writable files and one to find files not owned by the design group.

Read the worked answer

chmod -R 777 is simpler only in the sense that it removes the need to think. It gives every user and every process on the host write and execute permission on all design files and directories. A single compromised account, a malicious script, or a careless command can then alter or delete artwork, plant a replacement binary, or encrypt the share. It also defeats the group model and makes auditing impossible because 'who may write' becomes 'everyone.' The setgid bit can survive on directories, but file modes become 777 and any user can replace content. Use least privilege instead. Audit world-writable entries with find /srv/design -xdev -perm -0002 -ls; that includes files and directories, and -xdev avoids crossing into other filesystems. Find files not owned by the design group with find /srv/design -xdev ! -group design -ls. Check the sticky bit on shared scratch areas: ls -ld /tmp should show t, which prevents users deleting each other's files in a world-writable directory, but sticky does not make 777 safe for a design share. If you need a drop box, use a separate directory with write-only permissions or ACLs, not 777 on the main tree.