Msys Shell命令更改文件的属性 [英] Msys shell command to change the attributes of a file

查看:220
本文介绍了Msys Shell命令更改文件的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请让我知道一个MSYS Shell命令,该命令可用于更改文件的属性.当我以ls -l身份运行命令时,得到以下信息:

Please let me know a MSYS shell command that can be used for changing the attributes of a file. When I ran a command as ls -l I got the following :

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

我想提供完整的访问权限.

I want to provide full access rights.

我们非常感谢您的帮助.

Any help is highly appreciated.

谢谢

推荐答案

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

@cdhowie is right; this is a bug of msys tracked there -> http://sourceforge.net/tracker/?func=detail&atid=102435&aid=3071537&group_id=2435

除非伪造它,否则它所做的任何事情都不能做得比现在有用. 在POSIX仿真中,就像Cygwin一样.但是,Cygwin所做的是 大多无关紧要;由于MSYS是从Cygwin-1.3分叉的,因此大部分 伪造是故意禁用的-它不是MSYS的目标, 在Cygwin支持的范围内提供伪造的POSIX功能.如果你 想要Cygwin的行为,而MSYS无法为您充分保留它 需要,那么您应该使用Cygwin.

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旨在更好地与 native MS-Windows功能集成 由MinGW支持.在本机MS-Windows环境中,没有 可以将文件标记为可执行文件的文件系统属性-即 由文件数据空间内的魔字节序列指示,(和 通常还可以通过文件扩展名来匹配).不可能 MSYS chmod可以安全地对其进行修改,而没有文件损坏的风险,其他 而不是完全拥抱Cygwin的模仿.但是,那是 完全与MSYS项目目标相反-它只是不会 发生.

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提供了一种更改权限的好方法:

@kbulgrien gives the good approach to change the permissions:

  • cacls: http://ss64.com/nt/cacls.html, or
  • icacls: http://ss64.com/nt/icacls.html

注意:icaclscacls的新版本,可纠正多个问题,但Windows XP中似乎不存在.

Note: icacls is the new version of cacls correcting several issues but seems to be not present in Windows XP.

您可以使用以下两个命令之一向所有人授予完全访问权限:

You can use either of the following commands to give full access rights to Everyone:

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

请注意,使用caclsicacls后,Msys中的ls -l不会在实际ACL上显示准确的信息.

Note that ls -l in Msys won't display accurate information on real ACLs after the usage of cacls or icacls.

这篇关于Msys Shell命令更改文件的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆