|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『楼 主』:
【已结】怎么设置可创建可删除不可修改的目录权限
使用 LLM 解释/回答一下
最近研究防毒,最后想到这个简便的方法
-----------------------------------------------------------------
现在我想给ntfs盘里某个目录设置如下的权限:
1.可以在该目录内创建文件或子目录,子目录的权限自动继承该目录的权限,子目录可以重命名,可以删除
(命名与删除我这里实验总是一对孪生兄弟)
2.复制到(或剪切到,或新建到)该目录内的文件变为不可以编辑内容,不可以更改属性,但可以删除,
3.该目录属性不可更改,不可删除,不可重命名(这个容易办到,给父目录设置R权限)
PS: 如果123条要求难以同时实现可以舍弃第1,3条要求重点是第二条!
------------------------------------------------------------------
提前谢谢各位!
题外话:
前不久,我在D盘fat32分区下见到一金山专杀工具,具体名字忘了,只是它有着特殊的写保护功能,不能改名不能删除可以运行起来删毒,而且不能复制!用unlocker查看,里面没挂载任何进程,真佩服作者是怎么实现的?总之这些技巧对于我们使用计算机定能增添许多方便与实惠。
本帖以结,请参照此贴5楼根据实际做相应修改,
http://www.cn-dos.net/forum/viewthread.php?tid=48807
Last edited by plp626 on 2009-9-14 at 01:23 ]
Recently researching virus prevention, and finally thought of this simple method
-----------------------------------------------------------------
Now I want to set the following permissions for a certain directory in the NTFS disk:
1. Can create files or subdirectories in this directory, the permissions of subdirectories automatically inherit the permissions of this directory, subdirectories can be renamed, can be deleted
(Naming and deleting are always twin brothers in my experiment)
2. Files copied to (or cut to, or newly created to) this directory become unable to edit content, unable to change attributes, but can be deleted,
3. The attributes of this directory cannot be changed, cannot be deleted, cannot be renamed (this is easy to do, set R permission for the parent directory)
PS: If the requirements of 1, 2, 3 are difficult to achieve simultaneously, you can abandon requirements 1 and 3, and focus on requirement 2!
------------------------------------------------------------------
Thank you in advance!
Off-topic:
Not long ago, I saw a Kingsoft virus-killing tool in the FAT32 partition of drive D. I forgot the specific name, but it has a special write-protect function. It cannot be renamed, cannot be deleted, can be run to kill viruses, and cannot be copied! Using unlocker to check, there are no processes mounted inside. I really admire how the author implemented it? In short, these skills can add a lot of convenience and benefits to our use of the computer.
This post is closed. Please refer to post 5 of this thread for corresponding modifications according to the actual situation.
http://www.cn-dos.net/forum/viewthread.php?tid=48807
Last edited by plp626 on 2009-9-14 at 01:23 ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2009-9-12 08:46 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
我现在看到xcacls.vbs有这个参数:(可是那个试了试不行!不知错哪里了)
Perm: Is for "Files Only" and can be:
Permissions...
F Full control
M Modify
X read & eXecute
R Read
W Write
Advanced...
E Synchronize
D Take Ownership
C Change Permissions
B Read Permissions
A Delete
9 Write Attributes
8 Read Attributes
7 Delete Subfolders and Files
6 Traverse Folder / Execute File
5 Write Extended Attributes
4 Read Extended Attributes
3 Create Folders / Append Data
2 Create Files / Write Data
1 List Folder / Read Data
-------------------------------------------------
xcacls.vbs官方介绍:
http://support.microsoft.com/kb/825751
下载地址:
http://download.microsoft.com/download/f/7/8/f786aaf3-a37b-45ab-b0a2-8c8c18bbf483/XCacls_Installer.exe
I'm currently looking at the parameters of xcacls.vbs: (But it didn't work when I tried it! I don't know where the mistake is!)
Perm: Is for "Files Only" and can be:
Permissions...
F Full control
M Modify
X read & eXecute
R Read
W Write
Advanced...
E Synchronize
D Take Ownership
C Change Permissions
B Read Permissions
A Delete
9 Write Attributes
8 Read Attributes
7 Delete Subfolders and Files
6 Traverse Folder / Execute File
5 Write Extended Attributes
4 Read Extended Attributes
3 Create Folders / Append Data
2 Create Files / Write Data
1 List Folder / Read Data
-------------------------------------------------
XCacls.vbs official introduction:
http://support.microsoft.com/kb/825751
Download address:
http://download.microsoft.com/download/f/7/8/f786aaf3-a37b-45ab-b0a2-8c8c18bbf483/XCacls_Installer.exe
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2009-9-12 08:52 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
大哥,虽然讨论了以下。我还是决定重新看你的原则:
1.可以再该目录内创建文件,并且可以重命名,可以删除,
2.不可以编辑目录内任何文件的内容,不可以更改目录内任何文件的属性
3.该目录属性不可更改,不可删除,不可重命名
我觉得这个要求其实是可以这样实现的:
cacls 遍历该目录 属性为R
也就是该目录树是只读的。
然后你可以在改目录树下建立新的文件,对这个新的文件可以做任何修改。
当然我上面理解的应该不对。
对目录全部系 地只读,又要能建立,删除,重命名文件。
我想现在的cacls是不能做到的。
Last edited by 523066680 on 2009-9-12 at 10:55 ]
Brother, although we have discussed the following, I still decide to re-read your principles:
1. You can create files in this directory, and you can rename and delete them.
2. You cannot edit the content of any file in the directory, and you cannot change the attributes of any file in the directory.
3. The attributes of this directory cannot be changed, deleted, or renamed.
I think this requirement can actually be achieved like this:
cacls traverses this directory with the attribute set to R.
That is, the directory tree is read-only.
Then you can create new files under this directory tree, and you can make any modifications to this new file.
Of course, my above understanding should be incorrect.
The entire system directory is read-only, but you need to be able to create, delete, and rename files.
I think the current cacls cannot do this.
Last edited by 523066680 on 2009-9-12 at 10:55 ]
|

综合型编程论坛
我的作品索引 |
|
2009-9-12 10:54 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
不知道注册表能否做到?
曾经用cacls给 autorun.inf 加权限,结果病毒好像用了某种方法
强制给我的autorun.inf 重命名,然后它再建立它自己的autorun.inf。
也许注册表能实现更细节的限制?
I wonder if the registry can do it?
I once used cacls to add permissions to autorun.inf, but it seems the virus used some method to forcibly rename my autorun.inf and then create its own autorun.inf.
Maybe the registry can achieve more detailed restrictions?
|

综合型编程论坛
我的作品索引 |
|
2009-9-12 10:58 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
|
2009-9-12 11:47 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
Originally posted by HAT at 2009-9-12 11:47 AM:
参考:http://www.cn-dos.net/forum/viewthread.php?tid=35672#pid242113
cacls貌似无法实现目录内可删不可改的权限
版主提供的那个帖子,如何实现文件可读不可删? 只要父目录不具有delete权限即可(对于cacls命令只要设置父目录为C权限即可),我知道的。
---------------------------------------------------------------------------------------------
大家思考一下怎么防治文件被病毒感染的方法,当然压缩包,镜像,(这些方法也不保险,现在也有少部分病毒开始感染压缩包勒)等等也可以,但都不如我说的这个来的简便。
至于ifexist说的方法,我现在就这样用着(给右键添加一个命令---"给该文件设置everyone只读权限",但是还不是非常方便),
就是因为不方便才想到这种目录里文件自动赋予可读不可改的方法
---------------------------------------------------------------------------------------------
昨晚试验勒N次均告失败,再次看了这个xcacls.vbs的帮助,想和大家讨论下
3 Create Folders / Append Data
2 Create Files / Write Data //能创建文件则意味着可以写数据?! 那么则意味着可修改勒?!
1 List Folder / Read Data
难道我的要求是矛盾的 ?!
Originally posted by HAT at 2009-9-12 11:47 AM:
Reference: http://www.cn-dos.net/forum/viewthread.php?tid=35672#pid242113
It seems that cacls cannot achieve the permission of being able to delete but not modify within a directory.
Regarding the post provided by the moderator, how to achieve the permission of being able to read but not delete a file? As long as the parent directory does not have the delete permission (for the cacls command, just set the parent directory to C permission), I know that.
---------------------------------------------------------------------------------------------
Everyone, think about the methods to prevent files from being infected by viruses. Of course, compressed packages, images, etc. (these methods are not foolproof, and now there are also a few viruses that start to infect compressed packages), etc. can also be used, but none is as simple as what I am going to say.
As for the method mentioned by ifexist, I am using it like this now (adding a command to the right-click - "Set everyone read-only permission for this file", but it is still not very convenient).
It is because it is not convenient that I thought of this method of automatically giving files in the directory the permission of being able to read but not modify.
---------------------------------------------------------------------------------------------
I tried it many times last night and all failed. I read the help of this xcacls.vbs again and want to discuss with you.
3 Create Folders / Append Data
2 Create Files / Write Data //Being able to create a file means being able to write data?! Then it means being able to modify?!
1 List Folder / Read Data
Is my requirement contradictory ?!
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2009-9-13 03:17 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
1.可以再该目录内创建文件,并且可以重命名,可以删除(试验了下,可删除与可重命名好像是"共生的")
2.复制到(或剪切到)该目录内的文件变为不可以编辑内容,不可以更改属性
//复制进去的会继承目标文件夹的设置,剪贴进去的,会使用原来目录的权限设置
3.该目录属性不可更改,不可删除,不可重命名(这个容易办到,给父目录设置R权限)
ACL里只需要禁止创建文件夹就可以禁止修改文件
1. Files can be created in this directory, and they can be renamed and deleted (I tested, it seems that the ability to delete and rename is "interdependent").
2. Files copied (or cut) into this directory become uneditable and their attributes cannot be changed.
//Files copied in will inherit the settings of the target folder, and files cut in will use the permission settings of the original directory.
3. The attributes of this directory cannot be changed, deleted, or renamed (this is easy to do, set the R permission for the parent directory).
In ACL, just prohibiting the creation of folders can prohibit modifying files.
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2009-9-13 07:52 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by everest79 at 2009-9-13 07:52 AM:
1.可以再该目录内创建文件,并且可以重命名,可以删除(试验了下,可删除与可重命名好像是"共生的")
2.复制到(或剪切到)该目录内的文件变为 ...
不知道单独的禁止创建文件夹的参数怎么组合
3 Create Folders / Append Data
2 Create Files / Write Data
从这里看创建文件与创建目录是分开来的,
我说的编辑数据可能很不专业,看里面参数的解释,append应该是追加数据,write应该是创建新文件,不知道cacls对编辑数据是怎么定义的?
Last edited by plp626 on 2009-9-13 at 08:03 ]
Originally posted by everest79 at 2009-9-13 07:52 AM:
1. You can create files in this directory, and you can rename and delete them (tested, it seems that deleting and renaming are "symbiotic")
2. Files copied (or cut) into this directory become...
I don't know how to combine the parameters to specifically prohibit creating folders
3 Create Folders / Append Data
2 Create Files / Write Data
From here, creating files and creating directories are separate,
What I said about editing data may be very unprofessional. Looking at the parameter explanations inside, append should be appending data, and write should be creating a new file. I don't know how cacls defines editing data?
Last edited by plp626 on 2009-9-13 at 08:03 ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2009-9-13 08:02 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
3 Create Folders / Append Data 创建文件夹/追加数据 这个禁止掉就不可以修改文件了,但也建立不了文件夹
2 Create Files / Write Data 创建文件/写入数据
3 Create Folders / Append Data 创建文件夹/追加数据 这个禁止掉就不可以修改文件了,但也建立不了文件夹
2 Create Files / Write Data 创建文件/写入数据
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2009-9-13 08:05 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
Originally posted by everest79 at 2009-9-13 08:05 AM:
3 Create Folders / Append Data 创建文件夹/追加数据 这个禁止掉就不可以修改文件了,但也建立不了文件夹
2 Create Files / Write Data 创建文件/写入数据
问题是在那些参数只对文件有效,
Perm: Is for "Files Only" and can be:
Permissions...
F Full control
M Modify
X read & eXecute
R Read
W Write
Advanced...
E Synchronize
D Take Ownership
C Change Permissions
B Read Permissions
A Delete
我之前试了试 cscript xcacls.vbs test /g adm:F everyone:b148 鼠标连test目录都打不开(命令行下也不行,最后用/t 参数查看为test\*.* ACCESS_DENIED:)
查看了test目录acl信息为:
(OI)(IO)(特殊访问:)
READ_CONTROL --- b
SYNCHRONIZE --- e (这个不太懂)
FILE_GENERIC_READ ---?
FILE_READ_DATA ---1
FILE_READ_EA ---- 4
FILE_READ_ATTRIBUTES ----8
而 xcacls.vbs的R权限为
(OI)(CI):
READ_CONTROL ----B
SYNCHRONIZE ----E
FILE_GENERIC_READ ---我还不知道和那个参数有关
FILE_READ_DATA ---1
FILE_READ_EA ---4
FILE_READ_ATTRIBUTES---8
区别在b148是oi+io(只继承+对象继承)而R为oi+ci(只继承+容器继承),就是说前者只有文件获得了b148权限,而文件的所在目录还是不能访问,
现在问题在这里,我还没搞清,只是把我的疑问写出来,
如果要想实现可(创建文件)+(可访问+不可改)+(可删)需要
Create Files ---- 2
Read Data(但这意味着write date,还是那个疑问矛盾吗?)----1
Read Extended Attributes ---4
Read Attributes ---8
Read Permissions ---b
Delete ---- a
--------------------------------------------- 可这也还是仅仅对文件有效,要让文件自动继承目录的这种权限怎么弄?
Originally posted by everest79 at 2009-9-13 08:05 AM:
3 Create Folders / Append Data Disable this to prevent file modification, but also unable to create folders
2 Create Files / Write Data Create files / write data
The problem is that those parameters are only valid for files,
Perm: Is for "Files Only" and can be:
Permissions...
F Full control
M Modify
X read & eXecute
R Read
W Write
Advanced...
E Synchronize
D Take Ownership
C Change Permissions
B Read Permissions
A Delete
I tried earlier cscript xcacls.vbs test /g adm:F everyone:b148, and the mouse couldn't even open the test directory (not working in the command line either, finally using /t parameter to view as test\*.* ACCESS_DENIED:)
Checked the acl information of the test directory as:
(OI)(IO)(Special access:)
READ_CONTROL --- b
SYNCHRONIZE --- e (don't understand this too much)
FILE_GENERIC_READ ---?
FILE_READ_DATA ---1
FILE_READ_EA ---- 4
FILE_READ_ATTRIBUTES ----8
And the R permission of xcacls.vbs is
(OI)(CI):
READ_CONTROL ----B
SYNCHRONIZE ----E
FILE_GENERIC_READ ---I still don't know which parameter it relates to
FILE_READ_DATA ---1
FILE_READ_EA ---4
FILE_READ_ATTRIBUTES---8
The difference is that b148 is oi+io (only inherit + object inherit) while R is oi+ci (only inherit + container inherit), that is, only the files get the b148 permission, and the directory where the files are located still cannot be accessed,
Now the problem is here, I haven't figured it out yet, just writing out my doubts,
If you want to achieve (create file) + (accessible + not modifiable) + (deletable) need
Create Files ---- 2
Read Data (but this means write date, still that question contradiction?)----1
Read Extended Attributes ---4
Read Attributes ---8
Read Permissions ---b
Delete ---- a
--------------------------------------------- But this is still only valid for files, how to make the files automatically inherit the permissions of the directory?
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2009-9-13 09:07 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
你直接新建个文件夹,进安全,把继承去掉,然后取消创建文件夹/追加数据就可以了
You directly create a new folder, enter the security settings, remove the inheritance, and then uncheck the option to create folders/append data.
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2009-9-13 09:22 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
你说的这种"取消"好像没有指定参数,我只能用“不赋予相应权限”来间接实现,可是帮助信息里目录赋予这类权限真让我费脑子。
---------------------------------------------------------------------
/I 参数将可以关闭继承权限,还在试验中。。。。
/F This will change all
files under the inputed directory but will NOT
traverse sub directories unless /T is also present.
If filename is a directory, and /F is not used, no
files will be touched.
/S This will change all
sub folders under the inputed directory but will NOT
traverse sub directories unless /T is also present.
If filename is a directory, and /S is not used, no
sub directories will be touched.
/T Traverses each
subdirectory and makes the same changes.
This switch will traverse directories only if the
filename is a directory or is using wildcards.
这些参数表达的含义让人那以理解,/t 参数是针对目录的,可这又什么用处。。
关于xcacls.vbs的使用示例实在太少,网上搜索的也仅仅是官方的帮助。。。
Last edited by plp626 on 2009-9-13 at 09:48 ]
What you mentioned about "canceling" seems to have no specified parameters. I can only indirectly achieve it by using "not granting corresponding permissions", but the directory permission granting in the help information really puzzles me.
---------------------------------------------------------------------
The /I parameter can close the inherited permissions, and it's still in the experimental stage...
/F This will change all
files under the inputed directory but will NOT
traverse sub directories unless /T is also present.
If filename is a directory, and /F is not used, no
files will be touched.
/S This will change all
sub folders under the inputed directory but will NOT
traverse sub directories unless /T is also present.
If filename is a directory, and /S is not used, no
sub directories will be touched.
/T Traverses each
subdirectory and makes the same changes.
This switch will traverse directories only if the
filename is a directory or is using wildcards.
The meanings expressed by these parameters are hard to understand. The /t parameter is for directories, but what's the use of this.
There are really few usage examples of xcacls.vbs, and what's searched online are only the official help...
Last edited by plp626 on 2009-9-13 at 09:48 ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2009-9-13 09:31 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
我就没说用脚本,直接手工改
I just didn't say to use a script, directly modify manually
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2009-9-13 09:48 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
Originally posted by everest79 at 2009-9-13 09:48 AM:
我就没说用脚本,直接手工改
不会,
Originally posted by everest79 at 2009-9-13 09:48 AM:
I just didn't say to use a script, directly modify manually
No, I can't.
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2009-9-13 09:49 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
你在桌面上新建个文件夹,然后右键选属性,再选安全页面,再点高级,然后先把坐父项继承的钩去掉,应用,然后选你当前用户名,点编辑,进去把创建文件夹/追加数据的那个钩去掉再应用确定即可
Create a folder on the desktop, then right - click and select Properties, then select the Security page, then click Advanced. First, uncheck the box for inheriting from the parent, apply, then select your current user name, click Edit, go in and uncheck the box for Create folders/Append data, then apply and confirm.
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2009-9-13 09:55 |
|