Does changing a NTFS readonly attribute rewrite the file?

Abstract: Clarifies that changing the NTFS readonly attribute only updates metadata in the MFT without rewriting file content or data clusters.

Created: 2026-09-21 by
Changing the NTFS readonly attribute does not rewrite the file content. The operation only modifies the metadata stored in the Master File Table (MFT), leaving the actual data clusters on the disk completely untouched. This distinction is critical for understanding how Windows handles file protection and permission management at the low-level filesystem layer.

How the Readonly Attribute Works

The readonly flag is a simple boolean indicator within the file's attributes field in the NTFS MFT entry. When you set this attribute via Explorer or the command line, the operating system updates the file record to reflect that the file should be treated as read-only. This change happens instantly because it involves writing to the directory structure and the MFT, not the file's data stream.

It is important to understand that this attribute is distinct from NTFS Access Control Lists (ACLs). While ACLs define who can open a file and with what rights (Read, Write, Execute), the readonly attribute is a legacy compatibility feature that tells applications to refuse write operations if they respect standard POSIX or Windows conventions. However, it is not a security boundary. A user with appropriate permissions can still delete the file even if it is marked readonly, provided they have Delete permission on the parent folder. This common misconception often leads to confusion about whether the file itself has been altered.

Metadata vs. Data Streams

When you toggle the readonly state, only specific metadata fields are updated. These include the file attributes byte, which stores the readonly flag, and potentially the Last Modified timestamp, depending on the tool used. Crucially, the file size, creation time, and most importantly, the actual data bytes remain unchanged. No new sectors are allocated, and no existing sectors are overwritten.

This behavior contrasts sharply with operations that genuinely rewrite files. For instance, when you edit a document in a word processor and save it, the application may create a temporary file, write the new content to it, and then rename it over the original. In that scenario, the old data is eventually deallocated, and new data is written. Changing the readonly attribute bypasses all of this. It is purely a label change. If you were to compare the file hash before and after toggling the readonly bit, the result would be identical.

Impact on Timestamps

There is often debate regarding whether changing attributes affects timestamps. On modern NTFS versions, setting the readonly attribute typically updates the "Last Modified" timestamp. This is because the file record itself is being modified. However, the "Created" and "Last Accessed" timestamps usually remain stable unless the file is actively accessed during the operation. It does not trigger a full rewrite of the file contents, so the physical location of the data on the drive does not shift. This is why forensic tools can often recover "deleted" readonly files easily; the data was never touched.

Permissions and Deletion Nuances

A frequent point of confusion is the relationship between the readonly attribute and deletion. Many users believe that a readonly file cannot be deleted. This is false. Deletion is controlled by the Delete permission on the containing directory, not the readonly flag on the file. You can delete a readonly file without issue if your user account has the necessary rights. The readonly flag merely prevents modifications to the file's content while it exists. It acts as a soft lock against accidental edits, not a hard barrier against removal.

If you need true protection against modification, you must rely on NTFS ACLs. By removing Write access for specific users or groups, you enforce a security policy that the operating system kernel respects regardless of the readonly attribute. The readonly attribute is largely ignored by high-privilege processes or scripts that use low-level API calls to force writes. Therefore, relying solely on the readonly checkbox for security is ineffective.

Practical Implications for System Administrators

For administrators managing large sets of files, understanding this distinction is vital for scripting and automation. Tools like PowerShell's Set-ItemProperty or the attrib command modify the MFT entry directly. They do not invoke file I/O operations that would rewrite the data. This makes them extremely fast, even for large files. There is no performance penalty for toggling readonly on a 10GB video file compared to a 1KB text file.

However, be cautious when using third-party backup or synchronization tools. Some older utilities might misinterpret the readonly flag and skip files entirely, assuming they are immutable. Modern tools generally handle this correctly by checking both the attribute and the ACLs. If you encounter issues where files are not syncing, check if the readonly attribute is set and remove it temporarily, rather than worrying about data corruption.

Comparison with Other File Systems

While this behavior is standard for NTFS, other filesystems may handle attributes differently. For example, FAT32 also uses a readonly bit but lacks the sophisticated ACL support of NTFS. In networked environments, protocols like SMB or NFS may map these local attributes to remote permissions differently. Always verify how your specific environment interprets the readonly flag, especially when dealing with cross-platform data exchange.

Frequently Asked Questions

Can I delete a readonly file in Windows?

Yes, you can delete a readonly file if your user account has Delete permission on the parent folder. The readonly attribute only prevents content modification, not deletion. You may receive a confirmation dialog, but the operation will succeed.

Does changing readonly update the file hash?

No, changing the readonly attribute does not alter the file content, so the cryptographic hash remains exactly the same. Only the metadata in the MFT changes, which is separate from the data stream.

Why do some programs refuse to overwrite a readonly file?

Programs check the readonly attribute to prevent accidental data loss. If the flag is set, the application typically blocks write operations or prompts the user for confirmation. This is an application-level check, not a filesystem enforcement.

Is readonly a secure way to protect files?

No, readonly is not secure. Users with administrative privileges or those using low-level APIs can ignore the flag. To truly protect files, you should use NTFS Access Control Lists to restrict write permissions.

Does changing readonly affect the file size?

No, the file size remains unchanged. The operation only modifies a few bytes in the file record header within the Master File Table, leaving the data clusters intact.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More