Skip to main content

2750

SGID + 750

2750 combines:

  • **SGID (2) files created in directory inherit the directorys group; executables run with group privileges
  • Owner: rwx
  • Group: r-x
  • Others: --

Result:

Owner has full control, group can read/execute/inherit group, others have no access.

Useful in controlled team environments, not in public WordPress paths.

Objective

Understand when 2750 is appropriate, especially in shared administration contexts, and avoid misuse in WordPress deployments.

Concept Breakdown

Octal structure

DigitMeaning
2SGID
7Owner rwx
5Group r-x
0Others ---

Behavior

TargetResult
File execRuns with file’s group
DirectoryNew files inherit directory group
OthersNo access

Syntax Formula

Apply SGID + 750

chmod 2750 <file|dir>

Remove SGID

chmod g-s <file|dir>

Verify

ls -l <file|dir>

Permission Indicator

-rwxr-s---

or for directory:

drwxr-s---

**s appears in the group execute position.

Practical Example & Output

Create controlled shared directory

groupadd wpops
mkdir /srv/wpops
chgrp wpops /srv/wpops
chmod 2770 /srv/wpops # Note: 2770 common variant for write sharing

For strict 2750:

chmod 2750 /srv/wpops
ls -ld /srv/wpops

Expected:

drwxr-s--- ... /srv/wpops

Only owner + group members can access; group inherits future files.

WordPress-Relevant Usage

ScenarioValidNotes
Internal ops scripts directory✅ Good use case
Shared deployment cache✅ If not web-exposed
wp-content/uploads❌ Never
wp-content/cache❌ Breaks WP + security risk
Public www path❌ Bad practice
Shared SFTP area⚠️ Only if tightly controlled

WP Server Scenarios

Use CaseRecommendation
Ops automation folder under /srv✅ Valid
Git deploy staging workspace✅ Valid
WP content tree❌ Not allowed
Multi-user edit under public root❌ Replace with per-user + ACL

Security Considerations

Benefits

BenefitReason
Group inheritanceClean team collaboration
Others blockedRestricts world access
Group executeShared scripts possible

Risks

RiskCause
Privilege creepToo many group members
Web dir SGIDExploit path
User confusionWrong group ownership

Audit

find / -perm -2000 2>/dev/null

Fix

chmod g-s <path>

Best Practices

PracticeReason
Use only for internal admin group dirsControlled privilege sharing
Never in web rootAvoid WP attack chains
Prefer Git & sudo workflowsModern infra approach
Add ACL for specific usersAvoid over-granting group

Example:

setfacl -m u:developer:rwx /srv/wpops

WordPress Audit

Scan WP tree:

find /home -perm -2000

If 2750 present under public_html:

chmod g-s <path>
chmod 750 <path>

Then restore typical WP perms:

  • Directories: 755 or 750
  • Files: 644 or 640

Go-Live Checklist

Requirement
SGID only on internal dirs
No SGID inside WP tree
Group membership audited
ACL rules applied
Weekly SGID audit task

Troubleshooting Matrix

SymptomCauseFix
Group can't write2750 gives r-x onlyUse 2770 instead
WP file access deniedSGID misused in WP pathReset perms
Leaked file accessWrong groupFix group & ACL

Quick Lab

Create secure devops collaboration dir:

groupadd wpdev
mkdir /srv/wpdev
chgrp wpdev /srv/wpdev
chmod 2750 /srv/wpdev

Test group inheritance:

touch /srv/wpdev/test.txt
ls -l /srv/wpdev/test.txt

Group of file should be wpdev.

Cheat Sheet

CommandMeaning
chmod 2750SGID + 750
chmod g-sRemove SGID
find / -perm -2000Scan SGID
ls -lSpot s in group exec

Mini-Quiz

QuestionAnswer
What does 2 in 2750 mean?SGID
Group permission?r-x
Safe in wp-content?No
Indicator in ls?s in group exec

Reply **"Continue 1750" to proceed.