Artigo: 825751 - Última revisão: segunda-feira, 16 de Janeiro de 2006 - Revisão: 2.3 Como utilizar Xcacls.vbs para modificar permissões NTFS
Este artigo poderá conter hiperligações para conteúdo em inglês (ainda não traduzido). As opções mencionadas neste artigo poderão estar em inglês, consoante a versão do sistema operativo ou dos componentes instalados. Nesta páginaSumárioExiste uma versão actualizada da ferramenta Extended Change Access Control List (Xcacls.exe) disponível como um script do Microsoft Visual Basic (Xcacls.vbs) da Microsoft. Este artigo passo a passo descreve como utilizar o script Xcacls.vbs para modificar e visualizar permissões do sistema de ficheiros NTFS de ficheiros e pastas.
Pode utilizar o Xcacls.vbs a partir da linha de comandos para definir todas as opções de segurança do sistema de ficheiros acessíveis através do Explorador do Windows da Microsoft. O Xcacls.vbs apresenta e modifica as listas de controlo de acesso (ACLs, access control lists) de ficheiros. Nota: o Xcacls.vbs só é compatível com o Microsoft Windows 2000, com o Microsoft Windows XP e com o Microsoft Windows Server 2003. O Xcacls.vbs não é suportado pela Microsoft. Configurar e utilizar Xcacls.vbsPara configurar e utilizar o Xcacls.vbs, siga estes passos:
Sintaxe de comando de Xcacls.vbsO resultado do comando xcacls.vbs /? que se segue descreve a sintaxe de comando do Xcacls.vbs:Usage: XCACLS filename [/E] [/G ser:perm;spec] [...] [/R user [...]]
[/F] [/S] [/T]
[/P user:perm;spec [...]] [/D user:perm;spec] [...] [/O user] [/I ENABLE/COPY/REMOVE] [/N [/L filename] [/Q] [/DEBUG]
filename [Required] If used alone, it displays ACLs. (Filename can be a filename, directory name or wildcard
characters and can include the whole path. If path is missing, it is assumed to be under the
current directory.) Notes: - Put filename in quotes if it has spaces or special characters such as &, $, #, etc. - If
filename is a directory, all files and subdirectories under it will NOT be changed unless the /F or S is present.
/F [Used with Directory or Wildcard] This will change all files under the inputted directory but will
NOT traverse subdirectories unless /T is also present. If filename is a directory, and /F is not used, no files will be
touched.
/S [Used with Directory or Wildcard] This will change all subfolders under the inputted directory but
will NOT traverse subdirectories unless /T is also present.
If filename is a directory, and /S is not used, no subdirectories will be touched.
/T [Used only with a Directory] Traverses each subdirectory and makes the same changes. This switch will
traverse directories only if the filename is a directory or is using wildcard characters.
/E Edit ACL instead of replacing it.
/G user:GUI Grant security permissions similar to Windows GUI standard (non-advanced) choices.
/G user:Perm;Spec Grant specified user access rights. (/G adds to existing rights for user)
User: If User has spaces in it, enclose it in quotes. If User contains #machine#, it will replace
#machine# with the actual machine name if it is a non-domain controller, and replace it with the actual domain name
if it is a domain controller.
New to 3.0: User can be a string representing the actual SID, but MUST be lead by SID#
Example: SID#S-1-5-21-2127521184-160... (SID string shown has been shortened) (If any user has SID# then globally all
matches must match the SID (not name) so if your intention is to apply changes to all accounts that match Domain\User
then do not specify SID# as one of the users.)
GUI: Is for standard rights and can be: Permissions... F Full control M Modify X read and eXecute
L List folder contents R Read W Write Note: If a ; is present, this will be considered a Perm;Spec parameter pair.
Perm: Is for "Files Only" and can be: Permissions... F Full control M Modify X read and eXecute
R Read W Write Advanced... 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 Spec is
for "Folder and Subfolders only" and has the same choices as Perm.
/R user Revoke specified user's access rights. (Will remove any Allowed or Denied ACL's for user.)
/P user:GUI Replace security permissions similar to standard choices.
/P user:perm;spec Replace specified user's access rights. For access right specification see /G option.
(/P behaves like /G if there are no rights set for user.)
/D user:GUI Deny security permissions similar to standard choices.
/D user:perm;spec Deny specified user access rights. For access right specification see /G option.
(/D adds to existing rights for user.)
/O user Change the Ownership to this user or group.
/I switch Inheritance flag. If omitted, the default is to not touch Inherited ACL's. Switch can be:
ENABLE - This will turn on the Inheritance flag if it is not on already. COPY - This will turn off the Inheritance flag
and copy the Inherited ACL's into Effective ACL's.
REMOVE - This will turn off the Inheritance flag and will not copy the Inherited ACL's. This is the opposite of ENABLE.
If switch is not present, /I will be ignored and Inherited ACL's will remain untouched.
/L filename Filename for Logging. This can include a path name if the file is not under the current directory.
File will be appended to, or created if it does not exit. Must be Text file if it exists or error will occur.
If filename is omitted, the default name of XCACLS will be used.
/Q Turn on Quiet mode. By default, it is off. If it is turned on, there will be no display to
the screen.
/DEBUG Turn on Debug mode. By default, it is off. If it is turned on, there will be more information
displayed and/or logged. Information will show Sub/Function Enter and Exit as well as other important information.
/SERVER servername Enter a remote server to run script against.
/USER username Enter Username to impersonate for Remote Connections (requires PASS switch).
Will be ignored if it is for a Local Connection.
/PASS password Enter Password to go with USER switch (requires USER switch).
Wildcard characters can be used to specify more than one file in a command, such as: * Any string of zero or more
characters ? Any single character
You can specify more than one user in a command. You can combine access rights.Utilizar Xcacls.vbs para visualizar permissõesTambém pode utilizar o Xcacls.vbs para visualizar permissões de ficheiros e pastas. Por exemplo, se tiver uma pasta denominada C:\Teste, escreva o seguinte numa linha de comandos para visualizar as permissões da pasta e prima ENTER: xcacls.vbs c:\teste O exemplo que se segue é um resultado habitual:C:\>XCACLS.VBS c:\teste Microsoft (R) Windows Script Host versão 5.6 Copyright (C) Microsoft Corporation 1996-2001. Todos os direitos reservados. Starting XCACLS.VBS (Version: 3.4) Script at 6/11/2003 10:55:21 AM Startup directory: "C:\teste" Arguments Used: Filename = "c:\teste" ************************************************************************** Directory: C:\teste Permissions: Type Username Permissions Inheritance Allowed BUILTIN\Administradores Full Control This Folder, Subfolde Allowed NT AUTHORITY\SYSTEM Full Control This Folder, Subfolde Allowed Domínio1\Utilizador1 Full Control This Folder Only Allowed \CREATOR OWNER Special (Unknown) Subfolders and Files Allowed BUILTIN\Utilizadores Read and Execute This Folder, Subfolde Allowed BUILTIN\Utilizadores Create Folders / Appe This Folder and Subfo Allowed BUILTIN\Utilizadores Create Files / Write This Folder and Subfo No Auditing set Owner: Domínio1\Utilizador1 Nota: o resultado do comando xcacls.vbs c:\teste neste exemplo corresponde ao texto mostrado na interface gráfica do utilizador (GUI). Algumas palavras estão incompletas na janela de comandos. O resultado também apresenta a versão do script, o directório de arranque e os argumentos utilizados. Também pode utilizar caracteres universais para visualizar ficheiros correspondentes existentes no directório. Por exemplo, se escrever o que se segue, todos os ficheiros com uma extensão ".log" existentes na pasta C:\Teste serão apresentados: xcacls.vbs c:\teste\*.log ExemplosOs comandos Xcacls.vbs que se seguem são alguns exemplos da utilização de Xcacls.vbs. xcacls.vbs c:\teste\ /g domínio\utilizadorteste1:f /f /t /e Este comando edita permissões existentes. Concede controlo total a Domínio\UtilizadorTeste1 sobre todos os ficheiros de C:\Teste, atravessa subpastas de C:\Teste e, em seguida, altera quaisquer ficheiros encontrados. Este comando não altera directórios. xcacls.vbs c:\teste\ /g domínio\utilizadorteste1:f /s /l "c:\xcacls.log"Este comando substitui permissões existentes. Concede controlo total a Domínio\UtilizadorTeste1 sobre todas as subpastas de C:\Teste e regista em C:\Xcacls.log. Este comando não altera ficheiros e não atravessa directórios. xcacls.vbs c:\teste\readme.txt /o "computadora\grupo1"Este comando altera o proprietário de Readme.txt para ComputadorA\Grupo1. xcacls.vbs c:\teste\badcode.exe /r "computadora\grupo1" /r "domínio\utilizadorteste1"Este comando revoga as permissões para C:\Teste\Badcode.exe de ComputadorA\Grupo1 e Domínio\UtilizadorTeste1. xcacls.vbs c:\teste\subdir1 /i enable /qEste comando activa a herança na pasta C:\Teste\Subdir1. Suprime qualquer resultado no ecrã. xcacls.vbs \\servidora\partilhaz\páginateste.htm /p "domínio\grupo2":14Este comando liga remotamente a \\ServidorA\PartilhaZ utilizando WMI (Windows Management Instrumentation). Em seguida, obtém o caminho local dessa partilha e, nesse caminho, altera as permissões de PáginaTeste.htm. Deixa as permissões existentes de Domínio\Grupo2 intactas, mas adiciona as permissões 1 (ler dados) e 4 (ler atributos expandidos). O comando elimina outras permissões do ficheiro porque o parâmetro /e não foi utilizado. xcacls.vbs d:\default.htm /g "domínio\grupo2":f /server servidora /user servidora\admin /pass palavra-passe /eEste comando utiliza WMI para ligar remotamente como ServidorA\Admin ao ServidorA e, em seguida, concede permissões totais para Default.htm a Domínio\Grupo2. As permissões existentes de Domínio\Grupo2 são perdidas e outras permissões permanecem. Referências
Para obter informações adicionais sobre como utilizar Xcacls.exe, clique no número de artigo que se segue para visualizar o artigo na base de dados de conhecimento da Microsoft (KB, Microsoft Knowledge Base):
318754
(http://support.microsoft.com/kb/318754/
)
How to use Xcacls.exe to modify NTFS permissions
A informação contida neste artigo aplica-se a:
| Outros Recursos Outros Sites de Suporte
ComunidadesObtenha Ajuda AgoraTraduções de Artigos
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Voltar ao topo