Skip to main content

2744

SGID + 744

2744 combines:

  • SGID (2) processes run or files created inherit directory group
  • Owner: rwx
  • Group: r--
  • Others: r--

Effect: only the owner can execute/write, group and others can only read, and the SGID inheritance applies.

This creates a **read-share, controlled owner execution environment.

Rare in WordPress systems. Used when a single trusted user executes files but the group needs read-only access, with group inheritance on new files.

Objective​

Understand 2744 and enforce correct usage in a WordPress VPS.

Concept Breakdown​

Octal structure​

DigitMeaning
2SGID enabled
7Owner rwx
4Group r--
4Others r--

Behavior​

TargetResult
File (executable)Owner executes w/ group privilege if applicable
DirectoryNew files inherit group

Syntax Formula​

Apply SGID + 744​

chmod 2744 <file|directory>

Remove SGID​

chmod g-s <file|directory>

Verify​

ls -l <file|directory>

Permission Indicator​

File:

-rwxr--r-- -> normal
-rwxr-Sr-- -> if no execute for group (common for 744)

Directory:

drwxr-Sr-- # SGID on directory

Key: **S in the group execute position because group exec is missing.

Practical Example & Output​

Create secure shared-read folder:

groupadd seo-team
mkdir /srv/docs
chgrp seo-team /srv/docs
chmod 2744 /srv/docs
ls -ld /srv/docs

Expected:

drwxr-Sr-- ... /srv/docs

Meaning: owner has full control, team can read, SGID applies for group inheritance.

WordPress-Relevant Usage​

ScenarioValidNotes
Shared docs/config folder for devops✅ If outside web root
Read-only internal scripts✅ If not web-exposed
wp-content/uploads❌ Breaks upload flow
Plugin/theme directories❌ Unusable, insecure pattern
User home WP dirs❌ Avoid SGID in production WP tree

WP Production Scenarios​

Use CaseGuidance
Internal control scripts repoPossible if group read-only needed
Shared read folder for opsFine outside web root
WP core, theme, plugin dirsDo not use
Public file areaProhibited

Security Considerations​

Benefits​

BenefitReason
Shared visibilityTeam can audit scripts
Owner-only writeIntegrity preserved
Group inheritanceConsistent group tagging

Risks​

ProblemCause
Wrong perms break WPWP needs write in content dirs
SGID in web treeEscalation potential
Misplaced trustRead access leaks sensitive scripts

Best Practices​

PracticeReason
Use only for internal operational directoriesPrevent WP conflict
Avoid in /home/*/public_htmlAttack surface reduction
Prefer Git + correct usersClean privilege model
Pair with ACLs for exceptionsFlexibility

ACL example:

setfacl -m g:seo-team:r /srv/docs

WordPress Audit​

Check for SGID in WP paths:

find /home -perm -2000

If 2744 appears:

chmod g-s <dir>
chmod 744 <dir>

Go-Live Checklist​

Requirement✅
Only internal/shared doc dirs using 2744✅
No SGID under WP tree✅
ACLs/sudo where needed✅
Weekly audit scheduled✅

Troubleshooting Matrix​

SymptomCauseFix
Users can't modifyMode is 2744Owner changes or use ACL
WP media upload failsMisapplied SGIDRemove + set 755/750
Team cannot run scriptExec only for ownerUse sudo or ACL

Quick Lab​

Shared read-only directory test:

mkdir /srv/readshare
groupadd readers
chgrp readers /srv/readshare
chmod 2744 /srv/readshare

Create file:

touch /srv/readshare/info.txt

Verify:

ls -ld /srv/readshare

Expect group read only, SGID inheritance set.

Cheat Sheet​

CommandPurpose
chmod 2744SGID + 744
chmod g-sRemove SGID
find / -perm -2000Audit SGID
ls -lSpot S in group exec slot

Mini-Quiz​

QuestionAnswer
Meaning of 2 in 2744?SGID
Group permission?Read only
Safe in wp-content?No
Indicator?S in group execute bit