Web Server (Apache/Nginx) File Permission Tool
<p>A tool to generate optimal file and directory permissions for Apache and Nginx web servers, for secure and functional website hosting.</p>
Web Server File Permission Tool
Configure Web Server Settings
The main directory where your website files are stored
Leave empty to use default (www-data)
Leave empty to use default (www-data)
Understanding Web Server Permissions
Properly configured file and directory permissions are critical for web server security and functionality. The web server needs to read files to serve them, but overly permissive settings can lead to security vulnerabilities.
Common Permission Patterns
| Item | Numeric | Symbolic | Explanation |
|---|---|---|---|
| Directories | 755 | drwxr-xr-x | Owner can read/write/traverse, others can read/traverse |
| HTML/CSS/JS Files | 644 | -rw-r--r-- | Owner can read/write, others can read only |
| PHP/Scripts | 644 | -rw-r--r-- | Same as static files (executed by the web server) |
| Config Files | 640 | -rw-r----- | Owner can read/write, group can read, others no access |
| Upload Directories | 775 | drwxrwxr-x | Web server needs write access for uploads |
| Log Files | 660 | -rw-rw---- | Owner and group can read/write, others no access |
Security Best Practices
- Never set
777(world-writable) permissions on web directories or files - Make sure directory contents can't be listed without an index file
- Use
750or stricter for sensitive configuration directories - Apply the principle of least privilege - give only the minimum permissions necessary
- Regularly audit file permissions, especially after updates or installations
- Use suEXEC, php-fpm, or similar technologies to run scripts as specific users
Web Server User Differences
Apache Users
- Ubuntu/Debian: www-data
- CentOS/RHEL: apache
- Arch Linux: http
- FreeBSD: www
Nginx Users
- Ubuntu/Debian: www-data
- CentOS/RHEL: nginx
- Arch Linux: http
- FreeBSD: www
Related Tools
Account Lock/Unlock Script Generator
Generate Linux user account lock/unlock scripts and commands. Create automated scripts for managing account security, password policies, and user access control with comprehensive logging and notifications.
Bind Mount Generator
Generate bind mount configurations for chroot environments, containers, and directory overlays. Create mount commands, fstab entries, and systemd mount units with proper options for various bind mount scenarios.
Command Retry Cron Generator
Create cron jobs with intelligent retry logic and exponential backoff for failed commands. Generate retry scripts, systemd timers, and cron entries with configurable retry strategies.
Scheduler with Random Delay Generator
Generate cron schedules with random delays to prevent thundering herd problems. Add jitter to your scheduled jobs.
Scheduler for Holiday-Safe Execution (skip weekends/holidays)
Create cron schedules that automatically skip weekends and holidays. Generate business-day-only scheduling expressions.
Timezone Cron Adjuster (convert job to UTC)
Convert cron expressions between different timezones. Adjust scheduled jobs for UTC or other timezone requirements.
Stay Updated with Linux Tips
Get weekly tutorials, command references, and new tool announcements delivered straight to your inbox.