I'm working on simulating some commands in a Unix-like environment. I'm on Windows 10 and using GitBash's shell to run commands but chmod doesn't appear to keep the permission changes on a file.
zecuse MINGW64 ~ (dev)
$ touch test
zecuse MINGW64 ~ (dev)
$ ls -l test
-rw-r--r-- 1 zecuse 1049089 0 Nov 13 13:30 test
zecuse MINGW64 ~ (dev)
$ chmod -c -r test
mode of 'test' changed from 0644 (rw-r--r--) to 0200 (-w-------)
zecuse MINGW64 ~ (dev)
$ ls -l test
-rw-r--r-- 1 zecuse 1049089 0 Nov 13 13:30 test
Does Windows prevent me from changing file permissions in this way? If so, do I need to use powershell to modify a file's permissions?
An equivalent of chmod would be icacls
Please refer -
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/icacls
How to grant permission to users for a directory using command line in Windows?
In case of chmod 0200 - user write permission
Try using cmd prompt or PowerShell
icacls test1 /grant User1:(w)
No, it doesn't seem like the windows file system is compatible with gitbash chmod: https://www.reddit.com/r/git/comments/dss843/chmod_not_working_with_git_bash_in_windows/
I don't think this is relevant to powershell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With