Как я могу рекурсивно изменить ACL с помощью cacls.exe?

7488
maaartinus

Я хочу ограничить доступ ко всему внутри workкаталога для меня и только для системы. Я попробовал это с помощью следующей команды:

cacls.exe work /t /p 'PIXLA09\Maaartin:f' 'NT AUTHORITY\SYSTEM':f 

Однако это не работает вообще. Следующая команда должна показывать только двух указанных пользователей, но вместо этого показывает очень длинный список разрешений:

cacls.exe work/somedirectory 

Я пытался использовать /gвместо /p, тоже. Поскольку я не использовал /eразрешения, их не нужно редактировать, а заменять.

Есть идеи что не так?

5

1 ответ на вопрос

0
sahmeepee

There might be a small error in your first commandline. The :f should be outside the quotation marks. It also seems that you have used single quotes instead of double quotes. That didn't work when I tried it.

This command line worked OK for me:

cacls test /t /g "computername\sahmeepee":f "system":f 

or using your names:

cacls work /t /g "PIXLA09\Maaartin":f "system":f 

Another possible issue is the strange order in which the cacls command seems to apply permission changes. If you run the command above, but instead of your own account you grant permissions to someone else's, only the directory "test" will be affected - not its subdirectories. This is because the command seems to make changes from the top down, rather than from the bottom up, so when it comes to edit the ACLs on the subdirectories it no longer has permission!

Моя вина - я забыл упомянуть, что он запускался из командной строки Cygwin. AFAIK, bash удаляет одинарные кавычки, которые нужны там, чтобы буквально интерпретировать обратную косую черту. Я попробую еще раз из оболочки WINDOZE и исправлю свой вопрос. maaartinus 13 лет назад 0

Похожие вопросы