How can I recursively change permissions for files and directories on Windows Subsystem for Linux?

0

Every time I use sudo chmod -R +755 * or sudo chmod -R +755 ., it resets all of the file permissions to 000 in the directories and subdirectories.

If I run sudo chmod +755 *, it will properly add permissions for everything in the folder, but not subfolders.

Other variations, like

sudo find foldername -type d -exec chmod 755 {} ";"

also seem to reset permissions this way.

It also seems to ignore files and folders that begin with ., which is also undesired behavior.

Also, when I try to use sudo chmod 0000 filename, it only removes the write permissions. The read and execute permissions stay there. This also holds true when I use os.chmod() in Python3 (interpreter in the bash shell).

Windows 10 OS build is 17134.165

Max Candocia

Posted 2018-08-12T23:24:23.500

Reputation: 150

have you noticed that you're not using -R in your sudo command? – Ahmed Masud – 2018-08-12T23:48:51.080

Edit your question to include the version of Windows your using, the version of WSL, be as specific as possible – Ramhound – 2018-08-13T02:25:05.320

@AhmedMasud in the first two commands I am using -R. In the third command it is still recursively working, although it removes permissions, rather than adds them. – Max Candocia – 2018-08-13T02:37:06.313

So what WSL instance do you have installed? – Ramhound – 2018-08-13T02:39:32.913

Is there way to check version? When I searched for it, it looked like it was directly tied to the Windows version. That was explicit here: https://www.reddit.com/r/bashonubuntuonwindows/comments/5q341a/how_to_know_which_version_of_wls_is_installed/. And it was implicit in the other answers I saw on stackexchange sites.

– Max Candocia – 2018-08-13T02:48:09.687

... where are these files located? Are they Windows files? – muru – 2018-08-13T04:40:56.733

If any Windows program modify any file then WSL shows that file permission to 000. – Biswapriyo – 2018-08-13T08:04:55.383

No answers