mingw - Msys shell 命令更改文件的属性

标签 mingw msys file-attributes

请告诉我一个可用于更改文件属性的 MSYS shell 命令。当我运行 ls -l 命令时,我得到以下结果:

-rw-r--r-- 1 lenovo Admin .....m4sugar.m4

我想提供完全访问权限。

非常感谢任何帮助。

谢谢

最佳答案

@cdhowie 是对的;这是 msys 跟踪的一个错误 -> http://sourceforge.net/tracker/?func=detail&atid=102435&aid=3071537&group_id=2435

It cannot do anything more useful than it already does, unless it fakes it in the POSIX emulation, as Cygwin does. However, what Cygwin does is mostly irrelevant; since MSYS was forked from Cygwin-1.3, most of that faking was deliberately disabled -- it isn't an objective of MSYS, to provide faked POSIX features to the extent supported by Cygwin. If you want Cygwin's behaviour, and MSYS doesn't retain it sufficiently for your needs, then you should use Cygwin.

MSYS is designed to better integrate with the native MS-Windows features supported by MinGW. In this native MS-Windows environment, there is no file system attribute which can mark a file as executable -- that is indicated by magic byte sequences within the file's data space, (and usually also qualified by a file name extension to match). There is no way MSYS chmod can safely modify that, without risk of file corruption, other than by more completely embracing Cygwin's emulation. However, that is diametrically opposed to the MSYS Project objectives -- it just ain't going to happen.

@kbulgrien 给出了更改权限的好方法:

注意:icaclscacls的新版本纠正了几个问题,但 Windows XP 中似乎不存在。

您可以使用以下任一命令向每个人授予完全访问权限:

  • cacls "$file_path" //E //P Everyone:F
  • icacls "$file_path" //grant Everyone:F

请注意ls -l使用cacls后,Msys中将不会显示真实ACL的准确信息或icacls .

关于mingw - Msys shell 命令更改文件的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10915178/

相关文章:

c++ - Protobuf 3.0.0-alpha-1 无法在 Windows 上编译

vim - 从 MSYS 运行 vim --- 如何避免/更改 MSYS 环境变量?

Swift3.0 fileAttributes 在现有文件上抛出 "no such file"错误

lua - 如何检查文件是否在Lua中可执行?

c - 如何在最新编译器中使用仅限 C 的功能?

c - MinGW fprintf (vswprintf) 导致段错误

c++ - 如何解决-------在mingw上对 `__chkstk_ms'的 undefined reference -------

linux - 在linux中用mingw编译opengl

c++ - VSCode 不对库路径使用 compile_commands.json

batch-file - 测试批处理文件中的文件属性