How to Backup and Restore Permissions of Files, Folders, or Drives in Windows
On NTFS and ReFS volumes, you can set security permissions on files and folders. These permissions grant or deny access to the files and folders.
Every container (ex: folder) and object (ex: file) on the PC has a set of access control information attached to it. Known as a security descriptor, this information controls the type of access allowed to users and groups. The security descriptor is automatically created along with the container or object that is created.
When you are a member of a group (ex: "Administrators") that is associated with an object, you have some ability to manage the permissions on that object. For those objects you own, you have full control.
Permissions are defined within an object's security descriptor. Permissions are associated with, or assigned to, specific users and groups. For example, for the file Temp.dat, the built-in Administrators group might be assigned Read, Write, and Delete permissions, while the Backup Operators group might be assigned Read and Write permissions only.
Each assignment of permissions to a user or group is represented in the system as an access control entry (ACE). The entire set of permission entries in a security descriptor is known as a permission set or access control list (ACL). Thus, for a file named Temp.dat, the permission set includes two permission entries, one for the built-in Administrators group and one for the Backup Operators group.
There are two types of permissions: explicit permissions and inherited permissions.
- Explicit permissions are those that are set by default on non-child objects when the object is created, or by user action on non-child, parent, or child objects.
- Inherited permissions are those that are propagated to an object from a parent object. Inherited permissions ease the task of managing permissions and ensure consistency of permissions among all objects within a given container.
- Inherited Deny permissions do not prevent access to an object if the object has an explicit Allow permission entry.
- Explicit permissions take precedence over inherited permissions, even inherited Deny permissions.
By default, objects within a container inherit the permissions from that container when the objects are created. For example, when you create a folder called MyFolder, all subfolders and files created within MyFolder automatically inherit the permissions from that folder. Therefore, MyFolder has explicit permissions, while all subfolders and files within it have inherited permissions.
In Windows, you can back up the current permissions of a file, folder, or drive to a .txt file, and be able to restore the permissions later if needed.
This tutorial will show you how to backup and restore permissions for files, folders, and drives in Windows 7, Windows 8, and Windows 10.
While you must be signed in as an administrator to backup and restore permissions.
CONTENTS:
- Option One: To Backup Permissions of File, Folder, or Drive in Command Prompt
- Option Two: To Restore Permissions of File, Folder, or Drive in Command Prompt
OPTION ONE
To Backup Permissions of File, Folder, or Drive in Command Prompt
1. Open an
elevated command prompt.
2. Go the step below you want to do:
3. Backup permissions of a file
A) Type the command below into the elevated command prompt, press
Enter, and go to
Step 7.
icacls "Full path of file" /save "%UserProfile%\Desktop\MyPermissions.txt"

Note
Substitute Full path of file in the command above with the actual full path of the file with extension you want to back up the permissions of this file only.
If you like, you can substitute MyPermissions in the command above with the name you want for the text file instead. This can make it easier to know what the .txt file is the backup for.
For example: icacls "F:\MyFolder\Lock.png" /save "%UserProfile%\Desktop\MyPermissions.txt"

4. Backup permissions of a folder
A) Type the command below into the elevated command prompt, press
Enter, and go to
Step 7.
icacls "Full path of folder" /save "%UserProfile%\Desktop\MyPermissions.txt"

Note
Substitute Full path of folder in the command above with the actual full path of the folder you want to back up the permissions of this folder only.
If you like, you can substitute MyPermissions in the command above with the name you want for the text file instead. This can make it easier to know what the .txt file is the backup for.
For example: icacls "F:\MyFolder" /save "%UserProfile%\Desktop\MyPermissions.txt"

5. Backup permissions of a folder, subfolder and files
A) Type the command below into the elevated command prompt, press
Enter, and go to
Step 7.
icacls "Full path of folder" /save "%UserProfile%\Desktop\MyPermissions.txt" /t /c

Note
Substitute Full path of folder in the command above with the actual full path of the folder you want to back up the permissions of this folder, subfolders and files.
If you like, you can substitute MyPermissions in the command above with the name you want for the text file instead. This can make it easier to know what the .txt file is the backup for.
For example: icacls "F:\MyFolder" /save "%UserProfile%\Desktop\MyPermissions.txt" /t /c

6. Backup permissions of a drive, subfolder and files
A) Type the command below into the elevated command prompt, press
Enter, and go to
Step 7.
icacls "Drive letter:\*" /save "%UserProfile%\Desktop\MyPermissions.txt" /t /c

Note
Substitute Drive letter in the command above with the actual drive letter you want to back up the permissions of this drive, subfolders and files.
If you like, you can substitute MyPermissions in the command above with the name you want for the text file instead. This can make it easier to know what the .txt file is the backup for.
For example: icacls "F:\*" /save "%UserProfile%\Desktop\MyPermissions.txt" /t /c

7. You will now have a
MyPermissions.txt file saved to your desktop that is the permissions backup of the file, folder, or drive. You can move this text file to where you would like to keep it saved at.
8. When finished, you can close the elevated command prompt if you like.
OPTION TWO
To Restore Permissions of File, Folder, or Drive in Command Prompt
1. Open an
elevated command prompt.
2. Go the step below you want to do:
3. Restore permissions of a file from backup
A) Type the command below into the elevated command prompt, press
Enter, and go to
Step 6.
icacls "Back one path from full path of file" /restore "Full path of MyPermissions.txt file"

Note
Substitute
Back one path from full path of file in the command above with the actual same full path of the file from the backup (ex: "F:\MyFolder\Lock.png"), but back one path (ex: "F:\MyFolder").
Substitute
Full path of MyPermissions.txt file in the command above with the actual full path of the text file with file extension created from
step 3 in Option One.
For example: icacls "F:\MyFolder" /restore "%UserProfile%\Desktop\MyPermissions.txt"

4. Restore permissions of a folder from backup
A) Type the command below into the elevated command prompt, press
Enter, and go to
Step 6.
icacls "Back one path from full path of folder" /restore "Full path of MyPermissions.txt file"

Note
Substitute
Back one path from full path of folder in the command above with the actual same full path of the folder from the backup (ex: "F:\MyFolder"), but back one path (ex: "F:").
Substitute
Full path of MyPermissions.txt file in the command above with the actual full path of the text file with file extension created from
step 4 in Option One or
step 5 in Option One.
For example: icacls "F:" /restore "%UserProfile%\Desktop\MyPermissions.txt"

5. Restore permissions of a drive from backup
A) Type the command below into the elevated command prompt, press
Enter, and go to
Step 6.
icacls "Back one path from full path of drive" /restore "Full path of MyPermissions.txt file"

Note
Substitute
Back one path from full path of drive in the command above with the actual same full path of the folder from the backup (ex: "F:\*"), but back one path (ex: "F:").
Substitute
Full path of MyPermissions.txt file in the command above with the actual full path of the text file with file extension created from
step 6 in Option One.
For example: icacls "F:" /restore "%UserProfile%\Desktop\MyPermissions.txt"

6. When finished, you can close the elevated command prompt if you like.
That's it,
Shawn Brink