所以解决方案是执行:# 这将影响从编辑器创建的文件夹mkdir -p ~/.vscode-server/&&回声umask 002">>~/.vscode-server/server-env-setupmkdir -p ~/.vscode-server-insiders/&&回声umask 002">>~/.vscode-server-insiders/server-env-setup# 这将影响从终端创建的文件夹回声umask 002">>~/.bashrcI'm currently in the process of switching from an Ubuntu 18.04 VirtualBox to the WSL.Everything is up and running to have a complete web dev environment.Unfortunately, the file permission and ownership is kind of a problem for me right now.--- Disclaimer---I know that in a server environment this would be pretty bad and wouldn't be done.This is just for my local development process and this requirement will stay there.What I want to achieve is, to have a consistent set of permissions and ownerships within my /var/www (and all below).Every element within /var/www should be owned by my shell user, regardless if file or dir.Every element should have the group www-dataso that the webserver user have access.Each file should have permission 0664 and each directory 0775.every new element should follow these requirements.What I researched so far:If I make a new directory/ file from the shell or within VSCode, my user and group are used.If I make a new directory from the windows explorer, the ownership is root:root. Nevertheless, I also have to figure out how to set default permissions for new objects.I just want an easy to use way to CRUD my files from anywhere I am on my system.Is there anyone with an idea for this?Thanks a lot, Danaq.Edit: It would also be ok, to set everything to www-data:ww-data and add my shell user to the www-data-group if the permissions are applied like explained above. 解决方案 According to this, newer versions of the Remote-WSL server, when they get started will execute (if present):~/.vscode-server/server-env-setup~/.vscode-server-insiders/server-env-setup(more on that)So a solution is to execute:# this will affect folders created from the editormkdir -p ~/.vscode-server/ && echo "umask 002" >> ~/.vscode-server/server-env-setupmkdir -p ~/.vscode-server-insiders/ && echo "umask 002" >> ~/.vscode-server-insiders/server-env-setup# this will affect folders created from terminalsecho "umask 002" >> ~/.bashrc 这篇关于WSL 中的默认权限和所有权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!