Skip to main content

2755

SGID + 755

2755 combines **SGID (2) with standard 755 permissions:

  • Owner: rwx
  • Group: r-x
  • Others: r-x
  • Group execute runs with file's group
  • New files inside SGID directories inherit the group

This is for controlled multi-user collaboration under a shared group rarely needed for WordPress hosting unless you have a dev/sysadmin shared environment.

Objective

Understand SGID + 755, when to apply it, and when to avoid it in WP environments.

Concept Breakdown

Octal structure

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

Actions

ContextBehavior
FileExecutes with file’s group
DirectoryNew files inherit group of directory

Syntax Formula

Apply SGID + 755

chmod 2755 <file/dir>

Remove SGID

chmod g-s <file/dir>

Verify

ls -l <file/dir>

Permission Indicator

Expected ls output:

-rwxr-sr-x

or (for dir)

drwxr-sr-x

Key marker: **s in group execute bit.

Practical Example & Output

Shared directory for dev/sysadmin team

groupadd webteam
mkdir /srv/webcollab
chgrp webteam /srv/webcollab
chmod 2775 /srv/webcollab
ls -ld /srv/webcollab

Expected:

drwxrwsr-x ... /srv/webcollab

File with SGID + 755

chmod 2755 /usr/local/bin/dev-tool
ls -l /usr/local/bin/dev-tool

Expected:

-rwxr-sr-x ... dev-tool

WordPress-Relevant Usage

ScenarioValidNotes
Shared CLI deployment directory✅ If internal admin only
Shared log/analyze dir for devops group✅ Safe if isolated
wp-content/uploads❌ Never
wp-content/cache❌ Never
Plugin/theme folders❌ Risky & unnecessary
User home under /home/siteuser❌ Use chown + ACL instead

Common WP Server Scenarios

| Case | Recommendation |

|---|---|---|

Team automation scripts | Prefer sudo + ACLs |

Git deployment pipeline | Better w/ correct git user |

Shared staging env folder | Allowed with strict group |

Public writable dirs | Never SGID |

Security Considerations

Risks

ThreatDescription
Privilege group escalationAny user inherits group
Misapplied to WP treeAttack path for write/delete
Confusion with SUIDBoth escalate but in diff ways

Audit

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

Removal

chmod g-s <path>

Best Practices

PracticeReason
Use SGID for internal shared dirs onlyControlled access
Avoid in /var/www & WP dirsAttack surface
Prefer group ACLsMore granular
Use sudoers for privilege elevationLogged & safe

Example ACL:

setfacl -m g:webteam:rwx /srv/webcollab

WordPress Audit

Check WP data path:

find /home -perm -2000

Expect zero SGID entries in:

  • wp-content/uploads
  • wp-content/cache
  • Themes/plugins

If found:

chmod g-s <path>

Go-Live Checklist

Checklist
SGID only in controlled shared dirs
No SGID in WP paths
Proper group ownership set
ACL/sudo rules configured
Audit cron scheduled

Troubleshooting Matrix

IssueCauseFix
Files inherit wrong groupSGID misusedchmod g-s
Shared scripts escalate wrong groupBad group ownershipchown root:webteam file
Unexpected WP privilegeSGID on WP dirsRemove & reset perms

Quick Lab

Create SGID share for WordPress dev team:

groupadd wpdev
mkdir /srv/wpdev
chgrp wpdev /srv/wpdev
chmod 2775 /srv/wpdev
touch /srv/wpdev/test
ls -l /srv/wpdev/test

Expected new file group wpdev

Cheat Sheet

CommandDescription
chmod 2755SGID + 755
chmod g-sRemove SGID
find / -perm -2000Scan SGID
ls -lCheck s in group bit

Mini Quiz

QuestionAnswer
What does 2 in 2755 do?Enables SGID
Where safe?Internal shared dirs
Safe for wp-content?No
Indicator in ls?s on group exec

Reply **"Continue 1755" to go next.