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

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

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

  1. 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.

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.