WSL & Windows

Manage Zone Identifier Files in WSL on Windows 10 and Windows 11

Copying a downloaded file from Windows into your WSL home directory can create a companion :Zone.Identifier file. Windows uses this metadata to record a…

Manage Zone Identifier Files in WSL on Windows 10 and Windows 11
Share:

Manage Zone Identifier Files in WSL on Windows 10 and Windows 11

4 min read
6.5K views

Copying a downloaded file from Windows into your WSL home directory can create a companion :Zone.Identifier file. Windows uses this metadata to record a file’s origin. This guide explains the difference between an NTFS stream and a Linux sidecar, then shows scoped cleanup and copy options.

This guide covers how to remove existing Zone.Identifier files and how to stop Windows from creating new ones.

Advertisement

What Are Zone.Identifier Files?

When you download a file in Windows (from a browser, email, etc.), Windows attaches a hidden Alternate Data Stream (ADS) called Zone.Identifier to it. This marks the file as coming from the internet so Windows can show security warnings when you try to open it.

On NTFS, Zone.Identifier is an alternate data stream, not an ordinary sibling file shown by ls on /mnt/c. When Windows Explorer or another Windows app copies or saves through the WSL share (such as \\wsl$\Ubuntu\home\yourname), it can materialize as a Linux sidecar. Microsoft’s WSL repository discussion describes this behavior. For example, after copying into a Linux project folder:

ls ~/projects/example/
setup.exe
setup.exe:Zone.Identifier
report.pdf
report.pdf:Zone.Identifier

They don’t cause any real harm, but they make directory listings messy and can cause issues with scripts that process all files in a folder.

Advertisement

Remove Existing Zone.Identifier Files

First change into the specific directory you intend to clean and preview the matching regular files:

find . -name "*:Zone.Identifier" -type f -print
  • -name "*:Zone.Identifier": matches any file ending with :Zone.Identifier
  • -type f: only matches files, not directories
  • -delete: removes each match

After reviewing the list and confirming the downloaded files are trusted, remove only those sidecars. Do not run this from your home directory or filesystem root:

find . -name "*:Zone.Identifier" -type f -delete

Optional: Disable Windows Origin Marking

The policy below disables zone marking for future attachments handled by Windows Attachment Manager. It affects downloads beyond WSL and reduces Windows’ ability to assess file risk. Prefer scoped cleanup or the copy workflow below; use this only if you intentionally accept that wider change.

Option A: Group Policy Editor (Windows Pro / Enterprise)

If you’re on Windows Pro or Enterprise, use the Group Policy Editor:

  1. Press Win + R, type gpedit.msc, and hit Enter
  2. Navigate to User Configuration > Administrative Templates > Windows Components > Attachment Manager
  3. Double-click Do not preserve zone information in file attachments
  4. Set it to Enabled and click OK
Manage Zone Identifier Files in WSL on Windows 10 and Windows 11

Attachment Manager will no longer preserve origin information under this policy; individual application behavior can vary.

Option B: Registry Edit (Windows Home)

Windows Home doesn’t include gpedit.msc. Use a registry edit instead. Open PowerShell as Administrator and run:

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v SaveZoneInformation /t REG_DWORD /d 1 /f

This creates the same setting as the Group Policy option. To undo it later:

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v SaveZoneInformation /f

Note: Disabling zone information means Windows will no longer warn you when opening files downloaded from the internet. This weakens Mark-of-the-Web protections, including origin-based security prompts and Office Protected View decisions. It is not a routine WSL requirement. Keep the default policy unless you have a specific reviewed reason to change it.

Copy Trusted Files from Inside WSL

Keeping projects under ~ is useful for Linux tooling, but Windows drag-and-drop into that filesystem can create the sidecars. For a file you have reviewed and trust, copy its ordinary contents from inside WSL instead of dragging it through Explorer:

mkdir -p ~/projects/example
cp /mnt/c/Users/yourname/Downloads/report.pdf ~/projects/example/

This plain Linux copy does not preserve the NTFS origin stream, so it also drops that origin metadata. Review the source first. Alternatively, in Windows PowerShell, inspect and unblock a single trusted source file before copying:

Get-Item -LiteralPath "$env:USERPROFILE\Downloads\report.pdf" -Stream Zone.Identifier
Unblock-File -LiteralPath "$env:USERPROFILE\Downloads\report.pdf" -Confirm

Unblock-File removes the Windows stream; it is different from deleting an already-created Linux sidecar. Open the resulting project using VS Code connected to WSL.

Ignore Zone.Identifier Files in Git

If your Git working tree contains ordinary Linux sidecar files and don’t want to accidentally commit Zone.Identifier files, add them to your .gitignore:

*:Zone.Identifier

Git ignores these ordinary files, not the NTFS stream itself. For other cross-platform file issues, see Git line endings on WSL. If you already use a global excludes file, add the pattern there rather than replacing that setting. Otherwise:

echo "*:Zone.Identifier" >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

Conclusion

Zone.Identifier files are a Windows security feature that leaks into WSL as visible files. You can delete them with find, prevent new ones with a Group Policy or registry change, or reduce sidecar creation with a reviewed Linux copy workflow. Global policy changes also remove origin information used for Windows security checks.

For more WSL setup tips, check out How to Install Ubuntu in WSL 2 on Windows or How to Make Resolve Config Changes Permanent in WSL 2.

Recommended for Linux builders

Contabo VPS hosting for Linux projects

Run Linux servers, automation tools, and self-hosted apps on a Contabo VPS with generous resources and predictable pricing.

Our customers sayExcellent4.6 out of 5 based on 11,008 reviews Trustpilot

Some links are affiliate links. This may earn LinuxBeast a commission at no extra cost to you.

Privacy settings

Choose which privacy controls to open.

Opening these controls does not change your saved choices.