是否可以在 Windows XP 中创建只读目录?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1054476/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:43:44  来源:igfitidea点击:

Is it possible to make a read only directory in windows XP?

windowspermissionsdirectory

提问by

According to http://support.microsoft.com/kb/326549the read only attribute is typically used for reasons other than marking a folder as actually read-only. Therefore it seems to me that it is not possible to make a directory read only in the same sense as linux using chmod a-w.

根据http://support.microsoft.com/kb/326549,只读属性通常用于将文件夹标记为实际只读以外的其他原因。因此,在我看来,不可能使用 chmod aw 使目录在与 linux 相同的意义上只读。

回答by Treb

Interesting, I didn't know that! I just tried it, you can set the readonly attribute on a folder with the attribcommand, but it has no effect.

有趣的是,我不知道!我刚试过,可以用attrib命令在文件夹上设置只读属性,但是没有效果。

The only alternative I see is setting the access rights to the directory based on the user account, if it is on an NTFS formatted drive. Have a look at the Xcaclstool from Microsoft.

我看到的唯一替代方法是根据用户帐户设置对目录的访问权限,如果它位于 NTFS 格式的驱动器上。看看Microsoft的Xcacls工具。

Take care though, access permissions on NTFS are a good deal more complex than unix type access control. In general it's better to not allowa specific kind of access, than to denyit. I think this is no longer a problem today, but I remember back on good old NT 4, a freind of mine managed to deny all access to a folder, including the administrator account. He couldn't do anything afterwards, not even delete it...

不过请注意,NTFS 上的访问权限比 unix 类型的访问控制要复杂得多。一般来说,最好不允许特定类型的访问,而不是拒绝它。我认为今天这不再是问题,但我记得在旧的 NT 4 上,我的一个朋友设法拒绝了对文件夹的所有访问,包括管理员帐户。之后他什么也做不了,甚至连删除都没有……

回答by Matthew Scharley

This is true of the readonly flag. You CAN however use NTFS ACL's to do this. I forget exactly how this is done now, and it will only work for NTFS filesystems, but it's possible.

readonly 标志也是如此。但是,您可以使用 NTFS ACL 来执行此操作。我现在完全忘记了这是如何完成的,它仅适用于 NTFS 文件系统,但这是可能的。

Relevant links:

相关链接:

Specifically: http://www.ntfs.com/ntfs-permissions-setting.htm

具体:http: //www.ntfs.com/ntfs-permissions-setting.htm