You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Windows 10的Ubuntu应用中获取父系统文件读写权限的方法

解决WSL Ubuntu访问Windows文件权限拒绝的问题

Hey there! Let's tackle this permission issue you're facing when accessing Windows files from your Microsoft Store-installed Ubuntu (WSL). The root cause lies in how WSL maps Windows file system permissions to Linux-style permissions, but we've got two reliable fixes to sort this out:

方法1:修改WSL的全局挂载权限配置(推荐)

This is the cleanest way to set consistent permissions for all Windows files accessed via WSL, instead of adjusting each file individually.

  • First, open your Ubuntu terminal and create/edit the WSL config file:
    sudo nano /etc/wsl.conf
    
  • Paste the following content into the file. The umask value controls default permissions—0022 gives you read/write/execute access, while others get read/execute (a safe, standard setup):
    [automount]
    enabled = true
    options = "metadata,umask=0022,fmask=0133"
    mountFsTab = false
    
    If you need full read/write/execute access for everyone (not recommended for security, but useful in some cases), replace umask=0022,fmask=0133 with umask=0000.
  • Save the file (press Ctrl+O, then Enter, then Ctrl+X to exit nano).
  • Restart WSL to apply the changes: Open a Windows Command Prompt or PowerShell and run:
    wsl --shutdown
    
    Now reopen your Ubuntu terminal—your Windows files under /mnt/c (or other drives) should have the correct permissions.

方法2:在Windows中调整特定文件/文件夹的权限

If you only need to fix permissions for a single file or folder, you can adjust Windows' native security settings:

  • Locate the target file/folder in Windows File Explorer, right-click it, and select Properties.
  • Go to the Security tab, then click Edit to modify permissions.
  • Click Add, type Authenticated Users into the text box, then click Check Names (it should auto-complete the full name). Click OK.
  • In the permissions list for Authenticated Users, check the boxes for:
    • Read & Execute
    • List Folder Contents
    • Read
      If you need to modify the file/folder from Ubuntu, also check Write.
  • For folders, check the box at the bottom that says Replace all child object permission entries with inheritable permission entries from this object to apply the settings to all subfiles/folders.
  • Click Apply then OK to save changes. Go back to Ubuntu and try accessing the file again—it should work now.

A quick note: Avoid setting permissions for the Everyone group unless absolutely necessary, as it's a security risk. The sudo chmod command you tried only modifies the WSL permission layer, not the actual Windows security settings, so it won't stick long-term or fix the root issue.

内容的提问来源于stack exchange,提问作者Sritam Jagadev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 04:24:58