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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

When Apache runs as a systemd service, set its umask with a systemd drop-in—not in a user’s shell profile. Run sudo systemctl edit apache2 on Debian or Ubuntu, or sudo systemctl edit httpd on RHEL, Fedora, or Arch, add UMask=0027 under [Service], then reload systemd and restart Apache. The setting affects objects created after the restart; it does not change files that already exist.

The correct way to set Apache’s umask

A Linux service started by systemd receives its environment and file-creation mask from the service manager. Apache therefore does not use the umask value in your interactive shell, .bashrc, or another administrator’s login session. Put the setting in a systemd service override so it applies every time the service starts and survives package updates.

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

Use the unit name supplied by your distribution:

Distribution family Common unit Edit command
Debian or Ubuntu apache2.service sudo systemctl edit apache2
RHEL or Fedora httpd.service sudo systemctl edit httpd
Arch httpd.service sudo systemctl edit httpd

If you are unsure which name is installed, list matching unit files before editing:

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

In the editor opened by systemctl edit, add:

[Service]
UMask=0027

Save the override, then make systemd read it and restart Apache:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
sudo systemctl daemon-reload
sudo systemctl restart apache2   # use httpd on RHEL, Fedora, or Arch
systemctl cat apache2            # use httpd when that is your unit

The override is stored in systemd’s managed drop-in location rather than by editing the vendor unit supplied by the package. That separation prevents a package upgrade from silently replacing your local policy.

What a umask changes

The umask is a filter applied when a program asks the kernel to create a file, directory, or similar object. The requested mode is combined with the mask; bits present in the mask are removed from the mode being installed. It affects calls such as open(2) and mkdir(2).

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

A mask never adds permissions. The final mode also depends on the mode Apache or an application requests. Regular files are commonly requested with a 0666-style mode, while directories are commonly requested with a 0777-style mode. The execute bits on directories are necessary for traversal, so the same mask produces different numeric results for files and directories.

Requested mode Umask Typical resulting mode Effect
0666 (file) 0022 0644 Owner can read/write; group and others can read.
0666 (file) 0027 0640 Owner can read/write; group can read; others have no permissions.
0666 (file) 0007 0660 Owner and group can read/write; others have no permissions.
0777 (directory) 0022 0755 Owner can read/write/traverse; group and others can read/traverse.
0777 (directory) 0027 0750 Owner can read/write/traverse; group can read/traverse; others have no permissions.
0777 (directory) 0007 0770 Owner and group can read/write/traverse; others have no permissions.

The table describes the usual 0666 and 0777 requests, not a guarantee for every Apache module. An application can request a different mode, and it can call chmod later. If a program deliberately tightens or broadens its mode after creation, the umask alone will not explain the final permissions.

Choose a mask that matches your sharing policy

Use 0022 for traditional world-readable web objects

Systemd system units default to 0022. With ordinary 0666 file creation, that allows read access to group and others; with 0777 directories, it allows traversal and read access to group and others. This is convenient for content that must be publicly readable, but it is unsuitable when Apache-created files may contain private uploads, credentials, or per-user data.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Use 0027 to remove access for “other”

0027 removes group write and all permissions for “other.” A normal file request of 0666 becomes 0640, and a normal directory request of 0777 becomes 0750. The Apache service account retains the owner permissions permitted by the application’s requested mode. This is a common privacy-oriented policy when a designated group may need read access but unrelated local accounts must not have it.

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.

Use a group-collaboration policy only when it is intentional

If another local process or administrator must modify Apache-created files through group membership, a mask that preserves group write—such as 0007 for the usual 0666/0777 requests—may fit better. That choice produces 0660 files and 0770 directories. It also means every account in the owning group can modify those objects, so verify group membership and directory ownership before adopting it.

  • Decide whether Apache-created files are public, private to the service account, or shared with a controlled group.
  • Check whether uploads, logs, caches, and temporary files are all created under the same service context.
  • Test the strictest candidate in a staging directory before changing production behavior.
  • Remember that a stricter mask can make an application fail when it expects group or “other” access.

Step-by-step procedure on a Linux VPS

1. Confirm how Apache is launched

This procedure applies when systemd starts Apache. Confirm the unit name and status:

systemctl list-unit-files | rg 'apache2|httpd'
systemctl status apache2   # or httpd

If Apache is launched by a different supervisor, container runtime, or custom wrapper, configure the umask in that launcher instead. A setting in a systemd unit that is never used cannot affect the process.

2. Create a persistent drop-in

Open the override for the correct unit. Do not edit the distribution’s main unit file directly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
sudo systemctl edit apache2

On RHEL, Fedora, or Arch, substitute httpd. Add only the service setting required for the policy:

[Service]
UMask=0027

UMask= takes an access mode in octal notation. Keep the leading zero so the value is unambiguously interpreted as octal.

3. Reload the unit definition and restart Apache

sudo systemctl daemon-reload
sudo systemctl restart apache2

Use httpd in both commands on systems whose unit is named httpd.service. A restart is required because already-running worker processes retain the mask they inherited when they were started.

4. Inspect the effective unit configuration

systemctl cat apache2

Look for the generated drop-in and its [Service] section. This command shows the vendor unit together with local overrides, making it useful for detecting a typo, an override saved under the wrong unit name, or an edit that was not written.

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

5. Create a new object and measure its mode

Trigger the Apache operation that creates the object—a test upload, generated cache entry, log rotation output, or another normal application action—and inspect the newly created path:

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
stat -c '%A %a %U:%G %n' /path/to/new/object

Use a newly created object for this test. A changed umask is applied at creation time; it does not rewrite modes or ownership on files that were already present.

Why existing files do not change

Changing UMask changes the permissions placed on future creations. It does not recursively repair an upload tree, log directory, cache, or temporary directory. For existing data, choose an explicit remediation that reflects the intended policy:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use chown when the owner or group is wrong.
  • Use chmod when the mode bits need correction.
  • Use ACL tools when access must be granted to a specific group or account without changing the basic owner/group model.

Apply recursive changes carefully. A blanket mode change can remove directory traversal, break application writes, or expose files that should remain private. Make a backup or test on a representative staging tree first.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When the observed mode does not match the calculation

Default ACLs on a parent directory

A parent directory can carry a default POSIX ACL. In that case, inherited ACL entries influence the permissions of newly created children, so the result may not look like a simple bitwise umask calculation. Inspect the target directory and its parents:

getfacl /path/to/parent-directory

Check for a default: ACL section. If it grants or removes entries, account for that policy before changing Apache’s mask. Fix the ACL deliberately rather than repeatedly weakening the umask until the numbers happen to look right.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

The application requested a different mode

The 0640 and 0750 examples assume 0666-style file and 0777-style directory requests. Modules and applications can request other modes, then apply an additional chmod. Compare the requested mode in the application’s documentation or configuration with the mode shown by stat.

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

You restarted the wrong unit

It is possible to edit apache2 while the running service is httpd, or to have multiple instances with different unit names. Compare systemctl status, the output of list-unit-files, and systemctl cat for the unit that actually owns the worker processes.

Only old files were checked

Existing files retain their original mode. Remove this ambiguity by recording the timestamp or inode of a test object, creating a second object after the restart, and running stat on the new path.

Apache’s suexec setting is a separate control

Apache’s official build documentation lists --with-suexec-umask for processes started by suexec and states that it defaults to the system settings. This is not the same control as the runtime umask of the main Apache service.

If the site uses suexec, examine both paths independently: set the main service’s UMask= for objects created by the systemd-launched Apache service, and inspect the suexec build or distribution configuration for programs that suexec starts. Changing the service drop-in does not replace a separately compiled suexec policy.

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

Operational effects to test before production

A umask applies to every object created in the affected process context, not just the one file you first noticed. Test each category used by your deployment:

  • Uploads: confirm that Apache can create files and that the application can read or update them as designed.
  • Logs: verify that log writers, rotation jobs, monitoring agents, and administrators retain the required access.
  • Caches: check both file creation and directory traversal; a directory that loses execute permission can make otherwise readable files unreachable.
  • Temporary files: ensure cleanup jobs and helper processes can still access them.
  • Generated content: confirm that downstream services receive the intended read or write permissions.

Run these checks in a staging directory first. A stricter mask improves privacy only if it does not force operators to compensate later with unsafe, broad permissions.

Common mistakes and their fixes

Symptom Likely cause Fix
Changing .bashrc has no effect. Apache is a systemd service, not a child of your login shell. Set UMask= in the service drop-in and restart the unit.
systemctl cat shows no UMask. The override was saved under another unit or not saved. Run systemctl edit for the active unit and inspect it again.
New files still show unexpected group or other permissions. A default ACL or application-specific mode is involved. Inspect the parent with getfacl and check the application’s requested mode.
Only files created before the change look too permissive. Umask is not retroactive. Use a deliberate chown, chmod, or ACL correction for existing data.
Uploads begin failing after setting 0027. A helper or collaborator relied on group/other write or read access. Identify the required account or group, then choose a mask and ACL that grant only that access.
Suexec-launched programs have different modes. Suexec has its own build-time umask option. Inspect the suexec configuration separately from the systemd service.

Changing or removing the policy later

To change the value, reopen the same override, replace the octal value, save it, then run daemon-reload and restart the matching service. To return to the distribution default, remove the UMask= line from the drop-in and perform the same reload and restart sequence. Confirm the resulting behavior with a newly created test object rather than relying on an existing file.

Practical checklist

  1. Identify whether systemd launches Apache and determine whether the unit is apache2 or httpd.
  2. Choose a mask based on privacy and group-collaboration requirements, not on a copied number.
  3. Create a drop-in with systemctl edit; do not modify the vendor unit.
  4. Add [Service] and an octal UMask= value.
  5. Run systemctl daemon-reload, restart Apache, and inspect the merged unit with systemctl cat.
  6. Create a new Apache-owned object and verify its mode and ownership with stat.
  7. If the result differs, check the requested creation mode, parent default ACLs, and whether suexec or another wrapper created the object.
  8. Repair existing trees separately with carefully scoped ownership, mode, or ACL changes.

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.

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.