Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk9 min

How to Change the Default Umask in Apache on a Linux VPS

Use a systemd service drop-in to change Apache’s umask, then reload, restart, and test a newly created file. Learn how 0022, 0027, and 0077 affect permissions, why existing files do not change, and when ACLs or suexec require separate checks.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For an Apache service started by systemd, set the process umask in a systemd drop-in—not in a user’s shell profile. On Debian or Ubuntu, run sudo systemctl edit apache2; on RHEL, Fedora, or Arch, run sudo systemctl edit httpd. Add UMask=0027 beneath a [Service] section, reload systemd, restart Apache, and test a newly created file.

The right value depends on your sharing policy. A umask filters permission bits when Apache creates files and directories; it does not change objects that already exist. The result can also be affected by the mode requested by the application and by default ACLs on the parent directory.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Apache’s umask controls

A Linux process passes a requested mode to file-creation calls such as open(2) and mkdir(2). The process umask removes permission bits from that requested mode before the kernel creates the object. Apache therefore does not have one universal “Apache permission” independent of the application: the final mode is the combination of the application’s requested mode and Apache’s current umask.

For a systemd-managed service, the umask belongs to the service process context. A umask command in your interactive shell, or a value in ~/.bashrc, affects programs launched from that shell; it does not control a daemon started by systemd.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

What a common value means

UMask=0027 is a frequently useful security policy for web servers. It removes group-write permission and all permissions for “other” from newly created objects, while retaining owner permissions allowed by the requested mode. The exact mode still depends on whether the application requests a file-like mode (commonly based on 0666) or a directory-like mode (commonly based on 0777).

Requested mode With 0022 With 0027 With 0077
0666 (typical regular-file request) 0644 0640 0600
0777 (typical directory request) 0755 0750 0700

These are permission calculations, not guarantees that every Apache module or application will request those exact modes. A program may explicitly pass a more restrictive mode, and a directory’s default ACL may alter the inherited permissions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a mask that matches your sharing policy

Set the least permissive value that still allows the users and services that need to work with Apache-created data. Tightening the mask improves privacy, but can break deployments, upload processing, log collection, cache sharing, or maintenance jobs that rely on group or world access.

Umask Typical effect on a 0666 request Typical effect on a 0777 request When it may fit
0022 0644 0755 Traditional system-unit default; group and other can read files, and directories remain traversable.
0027 0640 0750 Private-by-default web content where a designated group may read or traverse objects.
0077 0600 0700 Data that must be accessible only to the Apache account unless ACLs or explicit permissions grant access.

Systemd documentation describes UMask= as an octal access-mode setting and gives 0022 as the default for system units. Treat that default as a starting point, not as a requirement: your application’s collaboration and isolation needs determine the appropriate value.

Identify the Apache service on your VPS

Unit names vary by distribution. Debian-family systems normally use apache2.service; Red Hat-family distributions and Arch commonly use httpd.service. Confirm the actual unit before editing it:

systemctl list-unit-files | rg 'apache2|httpd'

If rg is unavailable, use grep:

systemctl list-unit-files | grep -E 'apache2|httpd'

Use the unit name without the .service suffix in the commands below. If your distribution has a vendor-specific wrapper or a differently named instance unit, edit the unit that actually starts the worker processes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Set Apache’s runtime umask with a systemd drop-in

A drop-in override is the durable method because it is kept separately from the package-provided unit file. Package upgrades can replace vendor files; an override created by systemctl edit remains in systemd’s managed override location.

  1. Open the override editor. On Debian or Ubuntu, run:
    sudo systemctl edit apache2

    On RHEL, Fedora, or Arch, run:

    sudo systemctl edit httpd
  2. Add the service setting. Enter exactly:
    [Service]
    UMask=0027

    Replace 0027 with the policy you selected. Keep the value in octal notation; do not write a decimal equivalent.

  3. Save and close the editor. systemctl edit writes an override for that unit rather than modifying the distribution’s original unit file.
  4. Reload unit definitions.
    sudo systemctl daemon-reload

    This makes systemd reread the drop-in.

  5. Restart Apache. Use the matching unit:
    sudo systemctl restart apache2

    or:

    sudo systemctl restart httpd

    A restart is required so the newly launched Apache process receives the new umask.

Check the restart result immediately. A failed restart can leave the old process stopped, so inspect status and the journal before changing anything else:

sudo systemctl status apache2
sudo journalctl -u apache2 -n 50 --no-pager

Substitute httpd for the unit on Red Hat-family or Arch systems.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Confirm that systemd loaded the override

Display the complete unit and its drop-ins:

systemctl cat apache2

For an httpd service, run systemctl cat httpd. Look for the following in the effective service configuration:

[Service]
UMask=0027

If it is absent, check that you edited the correct unit, saved the file, and ran daemon-reload. If a later drop-in assigns another UMask=, the effective value is the one systemd applies after processing all overrides.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

You can also inspect the running process’s status information when diagnosing a mismatch. First identify the main process:

systemctl show -p MainPID --value apache2

Then inspect the process and its children using the tools available on your distribution. The service configuration shown by systemctl cat is the authoritative place to verify that the drop-in is present; a newly created test object is the authoritative place to verify the observed result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test the result with a newly created object

Umask is applied at creation time. Do not test by looking only at an old upload or log file, because changing the service does not rewrite existing permissions.

  1. Choose a disposable staging directory owned and writable by the Apache account, rather than a production upload or log tree.
  2. Trigger the same code path that normally creates the object. For example, perform a controlled upload or request that causes the application to write a test file.
  3. Inspect the result with stat.
    stat -c '%A %a %U:%G %n' /path/to/new-object
  4. Compare the mode with the requested mode. A file created from a 0666-style request under 0027 commonly appears as 0640; a directory created from a 0777-style request commonly appears as 0750.

Use a real application creation path for the final check. A shell command run as your own user tests your shell’s umask, not Apache’s service context.

Understand why the observed mode may differ

The application requested a different mode

Umask can only remove bits from the mode supplied by the creating call. If an application explicitly requests 0600, a less restrictive umask cannot add group or other permissions. Conversely, a directory request based on 0777 starts with execute bits that a file request based on 0666 does not.

A parent directory has a default ACL

Default POSIX ACLs on a parent directory can influence permissions inherited by new files and directories. When the result does not match the simple umask calculation, inspect the path:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
getfacl /path/to/parent

Look specifically for a default: ACL. Review the ACL policy before changing the umask again; otherwise you may make the service more restrictive while the ACL continues to grant access, or break an intentional group-sharing design.

A wrapper or separate process creates the object

Apache may hand work to another process, an application runtime, a queue worker, or a distribution-specific wrapper. The creator’s umask—not necessarily the main Apache parent’s value—controls the object. Trace the process that performs the write and configure its service context separately when required.

Apache suexec uses a separate setting

Apache’s suexec documentation lists the build option --with-suexec-umask for processes started by suexec and states that it defaults to the system settings. This is distinct from the runtime UMask= on the main apache2.service or httpd.service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If your virtual hosts use suexec, changing the main systemd service may not change the umask of suexec-launched programs. Inspect how suexec was built and how your distribution invokes it, then test a file created by the suexec path itself. Keep the two scopes separate:

Configuration Scope Persistence Typical reason to inspect it
Systemd UMask= Main Apache service and processes inheriting its context Drop-in survives vendor-unit replacement Uploads, logs, caches, and other objects created by the service
--with-suexec-umask Programs started through suexec Build-time or distribution packaging setting Per-user CGI or other suexec-managed execution paths
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Operational effects to check before tightening the mask

A stricter umask can solve accidental disclosure while creating a different failure: a process that previously read or traversed an object may lose access. Test each class of object your server creates.

  • Uploads: confirm the web application can read its own files and that any image, antivirus, indexing, or background worker has the intended access.
  • Logs: verify that your log collector, rotation job, and monitoring account can still read the files. Do not assume a log reader can access a directory merely because it can read an individual file; directory traversal permission matters.
  • Caches and compiled assets: check that the process serving cached content and the process generating it share the required group or ACL permissions.
  • Temporary files: ensure cleanup jobs can enumerate and remove temporary objects, while avoiding a policy that exposes sensitive temporary data.
  • Deployments: test release scripts, shared document roots, and maintenance accounts. A 0027 policy often requires a deliberate shared group or ACL arrangement.

Use a staging directory first, then deploy during a maintenance window if the service writes critical production data. Record the previous value so you can revert the drop-in quickly if an application path fails.

Changing permissions on objects that already exist

Changing UMask= does not repair old ownership or modes. Existing files retain the permissions they had when created. If an existing tree is too permissive, audit it and apply an intentional remediation policy with chown, chmod, or ACL tools.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not run a blanket recursive command without checking file types and service requirements. Files and directories commonly need different modes, and removing execute or traverse permission from a directory can make every child inaccessible even when the child’s own mode looks correct. Back up or snapshot the tree, test the command on a small sample, and preserve any deliberate set-user-ID, set-group-ID, or ACL configuration.

Troubleshooting checklist

Symptom Likely cause What to check
UMask= is not shown by systemctl cat Wrong unit edited, unsaved editor session, or missing reload Run systemctl list-unit-files, edit the actual unit, save, then run sudo systemctl daemon-reload.
New files still have the old mode Apache workers were not restarted, or another process creates the files Restart the service and trigger a fresh creation path; identify the actual writer.
Modes are more permissive than the calculation Parent default ACL or explicit application mode Run getfacl on the parent and review the application’s requested mode.
Uploads or cache generation fail after tightening A collaborating account lost read, write, or directory-traverse access Check ownership, group membership, ACLs, and directory modes; adjust the sharing policy rather than blindly loosening the global umask.
Apache will not start after editing Malformed unit override or unrelated configuration error Run systemctl status and journalctl -u; remove or correct the drop-in, then reload and restart.
Main service changed but suexec output did not suexec has its own build-time umask setting Inspect the suexec build and test a suexec-created object independently.

Reverting the change safely

To return to the vendor default, open the same override:

sudo systemctl edit apache2

Remove the UMask= line or remove the override content, save, then run:

sudo systemctl daemon-reload
sudo systemctl restart apache2

Use httpd instead of apache2 where appropriate. Confirm the effective configuration with systemctl cat and create a new test object; reverting the service setting still does not alter objects created while the stricter mask was active.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical decision sequence

  1. Identify the unit that actually launches Apache.
  2. List the accounts and services that must access Apache-created files.
  3. Choose the narrowest workable mask, commonly 0027 for group-readable private content or 0077 for owner-only data.
  4. Apply it in a systemd drop-in with systemctl edit.
  5. Reload systemd and restart Apache.
  6. Trigger a fresh creation through the real application path.
  7. Inspect mode, ownership, and ACLs with stat and getfacl.
  8. Test uploads, logs, caches, temporary files, deployment scripts, and any suexec workload before production rollout.

The Bottom Line

Set Apache’s service umask with a systemd drop-in: add UMask=0027 under [Service] using systemctl edit, run daemon-reload, restart the correct unit, and verify a newly created object. Treat suexec, default ACLs, and existing files as separate cases.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.