Microsoft advises you to not edit Linux files from Windows

As you may already know, Windows 10 comes with a Linux subsystem based on Ubuntu. It allows the user to use various console tools and install typical Linux servers and services. Microsoft is now warning users to not edit Linux files directly using Windows apps as they can permanently damage your Linux distro's installed copy.

Windows 10 Ubuntu bash in action

The Linux subsystem, when enabled, stores its files in the following folder:

%LOCALAPPDATA%\lxss

Tip: See how to enable Windows Subsystem for Linux (WSL) in Windows 10.

File metadata (e.g. permissions, ownership, timestamps, etc.) is represented differently in Linux than in Windows. Because Windows stores your Linux files in an NTFS folder, WSL calculates and persists each Linux file’s metadata in its NTFS extended attributes.

When you edit a file from outside the Windows Subsystem for Linux, a Windows app can ruin the stored metadata, as it knows nothing about Linux. Some Windows apps not only edit files but also delete the existing file and write an updated copy with the same name.

If this happens, all Linux-related properties will be removed from the extended file properties.

When Windows Subsystem for Linux finds broken metadata, it considers the file corrupt. Sometimes, it can even overwrite the file contents without actually corrupting the data.

Microsoft's recommendation is simple:

DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc.
Creating/changing Linux files from Windows will likely result in data corruption and/or damage your Linux environment requiring you to uninstall & reinstall your distro!
...

  • DO store files in your Windows filesystem that you want to create/modify using Windows tools AND Linux tools
  • DO NOT create / modify Linux files from Windows apps, tools, scripts or consoles

1 thought on “Microsoft advises you to not edit Linux files from Windows

  1. sketch

    MS should allow taking screenshots of WSL for easy rollback.

    I was thinking of directly syncing my config files from WSL to dropbox, now I have see how can it be done.

    Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.