我正在类似Unix的环境中模拟一些命令。我在Windows 10上,使用GitBash的shell运行命令,但chmod似乎不会将权限更改保留在文件上。
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
Windows是否阻止我以这种方式更改文件权限?如果是,我是否需要使用powershell来修改文件的权限?
chmod
的等价物是icacls
请参阅-
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/icacls
如何在Windows中使用命令行向用户授予目录权限?
在chmod 0200
的情况下-用户写入权限
尝试使用cmdprompt
或PowerShell
icacls test1/grant User1:(w(
不,windows文件系统似乎与gitbash chmod不兼容:https://www.reddit.com/r/git/comments/dss843/chmod_not_working_with_git_bash_in_windows/
我认为这与powershell无关。