10
4
mkdir
creates folders with 777 permission by default. How can I make 755 default?
Also when I clone a git repository all the files and folders are downloaded with 777 permission! How can I correct this problem?
Thanks.
10
4
mkdir
creates folders with 777 permission by default. How can I make 755 default?
Also when I clone a git repository all the files and folders are downloaded with 777 permission! How can I correct this problem?
Thanks.
12
Workaround is add
umask 022
to .bashrc
or similar.
1this is the correct answer, also small typo, its umask not unmask – Iraklis – 2017-03-09T10:21:19.820
1
See https://github.com/Microsoft/BashOnWindows/issues/81#issuecomment-207553514
The short version (assuming I'm interpreting it correctly) is 0777 is applied to everything under the mnt; however, anything in ~ is fair game. The file or directory needs to stay there though or it will revert back to 0777 when you move it into mnt.
Here is what I did to get the permissions to stick, but I'm not sure how to make it default to a specific permissions upon creation.
cd ~
cd ..
mv mnt/c/mydir/myfile.ext
chmod 755 myfile.ext
By the way, be sure you run WSL as administrator.
Here's a guide : https://codex.wordpress.org/Changing_File_Permissions
For your case, setting rwx-rx-rx (755) you can run the command: chmod 755 mydir.
I know how to run chmod. My question is not about how set permissions on files and folders. In Win 10 bash, there is a problem, and all files generated within the bash has 777 by default. New folders has 777 too. I would like to understand why this happens and fix this problem. – bisherbas – 2016-10-10T00:16:34.800