Prevent ‘Zone.Identifier’ Files from Appearing in WSL2

When using Windows Subsystem for Linux 2, we access our Linux file system using Windows Explorer. When we copying and pasting files, might notice addition files like ‘xxx Zone.Identifier‘.

The ‘Zone.Identifier‘ file is a Windows Attachment Manager feature that stores security information about files. However, since WSL2 uses an ext4 file system, Windows cannot store ADS natively. Instead, it creates a visible ‘Zone.Identifier‘ file in the same directory.

1. Delete Existing Files

If you already have ‘Zone.Identifier‘ files in your WSL2 directories, use one of the following methods to remove them.

find ~/[Your Path] -name "*:Zone.Identifier" -delete
Bash

2. Disable Windows from Generating ‘Zone.Identifier

If you frequently access WSL2 files from Windows and want to permanently stop Windows from attaching ‘Zone.Identifier’, you can disable this feature via Group Policy or Registry Editor.

Press Win + R, type gpedit.msc, and hit Enter.

Configuration → Administrative Templates → Windows Components → Attachment Manager
用户配置 → 管理模板 → Windows 组件 → 附件管理器(In Chinese)

Enable “Do not preserve zone information in file attachments

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

zh_CNCN