git-bash - chmod 命令在 GitBash 中的 Windows 上不起作用吗?
问题描述
我正在模拟类 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://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls
如果是 chmod 0200 - 用户写入权限
尝试使用 cmd 提示符或 powershell
icacls test1 /grant User1:(w)
推荐阅读
- node.js - 对象不存在 - Mongodb
- python - 对大熊猫具有决定性意义的树木
- flutter - 我想在我的颤振应用程序上正确加载其他屏幕
- amazon-web-services - 插值数据源
- javascript - 如何根据属性键过滤对象属性?
- c# - 在自定义 JSON 转换器中忽略具有属性的属性
- laravel - Laravel:跨数据透视表查询特定行
- rest - Blazor Webassembly 项目调用 REST API
- angular - Angular:为什么在“if 语句”中可以使用 const 作为布尔值?
- visual-studio-2019 - Visual Studio 2019 Release 文件夹中的哪些文件应该上传到 GitHub?