6

I am working on wsl2 of win10:

PS C:\Users\Gaowei> wsl -l -v
  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2

After entering wsl, I make a file of test.md:

➜  ~ ls -l test.md
-rwxrwxrwx 1 gaowei gaowei 0 Aug 25 17:17 test.md

then try to change its permissions:

➜  ~ chmod 755 test.md
➜  ~ ls -l test.md
-rwxrwxrwx 1 gaowei gaowei 0 Aug 25 17:17 test.md
➜  ~ sudo chmod 755 test.md
➜  ~ ls -l test.md
-rwxrwxrwx 1 gaowei gaowei 0 Aug 25 17:17 test.md

Unfortunately, it turn out to be stay unchanged.

My machine info:

gaowei@Spiritme
---------------
OS: Ubuntu 20.04.1 LTS on Windows 10 x86_64
Kernel: 4.19.104-microsoft-standard
Uptime: 4 mins
Packages: 1068 (dpkg)
Shell: zsh 5.8
Terminal: /dev/pts/0
CPU: AMD Ryzen 5 4500U with Radeon Graphics (6) @ 2.370GHz
Memory: 75MiB / 12277MiB

what's the problem it might be?

AbstProcDo
  • 19,953
  • 19
  • 81
  • 138

1 Answers1

11

The problem was solved by creating /etc/wsl.conf file and configuring it as:

# Enable extra metadata options by default
[automount]
enabled = true
root = /mnt/
options = "metadata,umask=22,fmask=11"
mountFsTab = false
# Enable DNS – even though these are turned on by default, we'll specify here just to be explicit.
[network]
generateHosts = true
generateResolvConf = true

Reference : wsl.conf

NotTheDr01ds
  • 15,620
  • 5
  • 44
  • 70
AbstProcDo
  • 19,953
  • 19
  • 81
  • 138