icacls: управление правами доступа через командную строку
icacls (Integrity Control Access Control List)
icacls is a command-line utility in Windows operating systems used to manage permissions for files, folders, registry, and other security objects. It has a wide range of functionality and allows detailed customization of access rights for different users and groups.
icacls enables the following actions:
- Displaying current permission settings.
- Assigning or removing access rights for users and groups.
- Inheriting or denying permission inheritance.
- Restoring default permissions.
- Replacing or copying existing access rights settings.
To use icacls, you need to open the command prompt. Then, you can execute various commands with the necessary parameters. Let's consider some code examples.
1. Displaying current permission settings for a file:
icacls C:\path\to\file.txt
The result will display information about access rights, the list of available users and groups, and inheritance settings.
2. Assigning access rights for a user to a folder:
icacls C:\path\to\folder /grant Username:(permission)
For example:
icacls C:\MyFiles /grant User:(F)
This command assigns full access rights to the folder "MyFiles" for the user "User".
3. Removing access rights for a user from a file:
icacls C:\path\to\file.txt /remove Username
For example:
icacls C:\SecretFile.txt /remove User
This command removes the user "User" from the list of permissions for the file "SecretFile.txt".
4. Inheriting permission settings on a folder:
icacls C:\path\to\folder /inheritance:e
For example:
icacls C:\Documents /inheritance:e
This command sets the "Documents" folder to deny permission inheritance from the parent folder.
5. Restoring default permissions:
icacls C:\path\to\folder /reset
For example:
icacls C:\MyDocuments /reset
This command resets all permission settings for the "MyDocuments" folder and restores default values.
These are just some examples of commands that can be used with icacls. The command-line utility has even more functionality and allows performing many other operations to manage access permissions in Windows operating systems.