Where is wsl.conf
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 17, 2026
Key Facts
- The wsl.conf file is stored in /etc/wsl.conf
- WSL 2 became the default version in Windows 10 May 2020 Update
- wsl.conf allows configuration of automount, networking, and boot options
- Editing wsl.conf requires restarting the WSL instance to apply changes
- The file uses INI-style syntax with sections like [automount] and [network]
Overview
The wsl.conf file is a critical configuration file used in Windows Subsystem for Linux (WSL) to define how Linux distributions integrate with the Windows host. It allows users to customize behaviors such as drive mounting, network settings, and boot options without requiring manual intervention after each session.
Located at /etc/wsl.conf inside the Linux distribution's root filesystem, this file is read by WSL during startup. Proper configuration can enhance performance, automate tasks, and improve interoperability between Windows and Linux environments.
- Location: The wsl.conf file resides in the /etc directory of the Linux distribution, specifically at /etc/wsl.conf, and must be edited within the Linux environment.
- Configuration Scope: Settings in wsl.conf apply to the entire Linux distribution and persist across reboots, making it ideal for permanent customizations.
- Supported Distributions: Any WSL-compatible Linux distribution, including Ubuntu, Debian, and Alpine, supports wsl.conf if properly configured.
- File Syntax: The file uses INI-style formatting with sections like [automount], [network], and [boot], each containing key-value pairs.
- Editing Requirements: Changes to wsl.conf require the user to restart the WSL instance using wsl --shutdown in PowerShell to take effect.
How It Works
Understanding how wsl.conf functions requires familiarity with its structure and interaction with the WSL kernel and Windows host system. The file is parsed at boot time, allowing users to fine-tune integration settings.
- Automount: The [automount] section controls how Windows drives are mounted; setting enabled=false disables automatic drive mounting, while root=/mnt sets the mount point.
- Network: The [network] section allows setting a static IP via generateHosts=false or disabling DNS auto-configuration with generateResolvConf=false.
- Boot: The [boot] section supports command= to run scripts at startup, such as initializing services or setting environment variables.
- Interop: The [interop] section controls Windows executable launching from Linux with enabled=true or appendWindowsPath=false to exclude PATH entries.
- Default User: The [user] section sets default=alice to automatically log in as user 'alice' upon WSL startup.
- Version Compatibility: wsl.conf is supported in WSL 1 and WSL 2, but some features like DNS control are only effective in WSL 2.
Comparison at a Glance
The following table compares key configuration options available in wsl.conf and their impact on system behavior.
| Section | Option | Default | Effect |
|---|---|---|---|
| [automount] | enabled | true | Automatically mounts Windows drives under /mnt |
| [automount] | root | /mnt | Sets base directory for mounted drives |
| [network] | generateHosts | true | Updates /etc/hosts with Windows host information |
| [network] | generateResolvConf | true | Generates resolv.conf for DNS resolution |
| [boot] | command | none | Runs custom command at WSL startup |
These settings allow deep customization of the WSL environment. For example, disabling generateResolvConf enables manual DNS configuration, which is useful in corporate networks with custom DNS servers. Each option directly affects integration, performance, or security, making wsl.conf essential for advanced users.
Why It Matters
Proper use of wsl.conf significantly improves the usability and efficiency of WSL for developers, system administrators, and power users. It enables automation, enhances security, and reduces friction between Windows and Linux environments.
- Automation: The boot.command option can start servers or scripts automatically, saving time during development workflows.
- Security: Disabling interop.enabled prevents accidental execution of Windows binaries from Linux, reducing attack surface.
- Performance: Customizing automount settings avoids unnecessary drive scanning, improving startup speed.
- Network Control: Setting static DNS via generateResolvConf=false ensures reliable connectivity in restricted networks.
- User Experience: Configuring default user eliminates repeated login prompts, streamlining access.
- Compatibility: Proper wsl.conf setup ensures consistent behavior across different Windows and WSL versions.
Mastering wsl.conf empowers users to tailor WSL to their specific needs, making it a vital tool for anyone using Linux on Windows for development or system management.
More Where Is in Daily Life
Also in Daily Life
More "Where Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- Microsoft DocsCC-BY-4.0
Missing an answer?
Suggest a question and we'll generate an answer for it.