Skip to main content

1777

Sticky Bit + 777

1777 means:

  • Sticky bit (1)
  • Owner rwx
  • Group rwx
  • Others rwx

It is **world-writable but with delete protection (only file owner/root can delete).

This mode is used in shared temp directories.

**Critical default example: /tmp

In WordPress hosting, never apply 1777 inside web-accessible directories. It exposes massive risk.

Objective​

Understand 1777, why it exists, and safe vs unsafe usage in WordPress VPS.

Concept Breakdown​

Octal structure​

DigitMeaning
1Sticky bit
7Owner rwx
7Group rwx
7Others rwx

Behavior​

  • Everyone can read/write/execute
  • Sticky protects deletion
  • Used for temporary storage where multiple users write files

Syntax Formula​

Set sticky + 777​

chmod 1777 <directory>

Remove sticky bit​

chmod -t <directory>

Permission Indicator​

ls -ld output:

drwxrwxrwt

t at others' execute slot confirms sticky bit.

Real Example​

/tmp default​

ls -ld /tmp

Expected:

drwxrwxrwt ... /tmp

Apply to a dir​

mkdir /srv/shared-tmp
chmod 1777 /srv/shared-tmp
ls -ld /srv/shared-tmp

WordPress-Relevant Usage​

ScenarioValidNotes
System /tmp✅ Default & necessary
Custom isolated temp folder✅ If outside web root
wp-content/uploads❌ Huge security risk
wp-content/cache❌ Never
Any public directory❌ Vulnerability
Multi-user SFTP scratch zone✅ With chroot + ACL

**Danger: Attackers can write web-executable files if used in WP dirs.

WP Production Scenarios​

CaseGuidance
OS tmp filesAccept default 1777
PHP tmp/sessionsSystem default, do nothing
WP uploads/cacheUse 755 or 750, not 1777
Team shared temp pathOnly outside /home/*/public_html

Security Considerations​

Risks if misused​

RiskWhy
RCE backdoorWorld-writable file upload path
Symlink attacksTemp file redirection
Privilege persistenceAttacker stores script
Arbitrary deletion abusePartial protection only

Audit​

find / -type d -perm -1000 2>/dev/null

Fix​

chmod -t <path>
chmod 755 <path>

Best Practices​

PracticeReason
Use 1777 only for OS temp dirsStandard security model
Never in WordPress directoriesUpload abuse / malware
Use per-site user ownershipHard isolation
Prefer ACL or sudo rulesSafer collaboration model

WordPress Audit​

Scan only WP dirs:

find /home -type d -perm -1000

If any directory under WordPress path is listed security issue.

Fix:

chmod -t <dir>
chmod 755 <dir>

Go-Live Checklist​

Checklist✅
1777 only for /tmp or admin scratch✅
No 1777 in wp-content✅
ACL model in shared zones✅
Temp isolation enforced✅
Weekly audit cron✅

Troubleshooting Matrix​

SymptomCauseFix
Visitors can upload files anywhereDirectory 1777 setchmod -t + 755
Malware found in uploadsWrong temp permsReset perms
Session hijacking alertsSticky mis-applied tmpUse system tmp

Quick Lab​

Simulate shared tmp:

mkdir /srv/tmp-test
chmod 1777 /srv/tmp-test
touch /srv/tmp-test/userfile
ls -ld /srv/tmp-test

Expected:

drwxrwxrwt ... /srv/tmp-test

Remove:

chmod 755 /srv/tmp-test

Cheat Sheet​

CommandPurpose
chmod 1777Sticky + 777
chmod -tRemove sticky
find / -perm -1000Audit sticky dirs
ls -ldVerify t bit

Mini-Quiz​

QuestionAnswer
What does 1777 mean?Sticky + world-writable
Safe for wp-content?No
Primary safe use case?/tmp
Indicator?t on others execute bit