Can Unrar Restore File Permissions from Metadata?
RAR archives are capable of storing detailed filesystem permissions,
and the unrar utility can restore these permissions to
match the original archive metadata. However, unrar cannot
inspect and patch the permissions of already-extracted files in-place;
to repair incorrect or missing permissions, you must re-extract the
files using the appropriate flags and administrative privileges. Whether
permissions can be recovered depends on how the archive was created, the
filesystem in use, and the user rights available during extraction.
How Permissions Are Stored in RAR Archives
When an archive is created, standard file data is packaged alongside optional filesystem metadata:
- Linux / POSIX Systems: Standard file permissions
(
rwxbitmasks for user, group, and others) are preserved automatically. Ownership information (UID and GID) can also be stored. - Windows / NTFS Systems: Extended file information,
such as Access Control Lists (ACLs), file owners, and audit information,
is preserved only if the archive was created using the
-owswitch.
If this metadata was stripped or excluded during compression,
unrar has no reference data to draw from and will apply the
default system permissions (such as the current umask on
Linux) to the extracted files.
Restoring Permissions on Linux and macOS
On Unix-like systems, unrar applies stored POSIX
permission bits automatically when using the extract command
(unrar x):
unrar x archive.rarTo fully repair or restore original user and group ownership, the
command must be run with elevated privileges (sudo or
root). If an unprivileged user extracts the archive, the
permission bits may be set, but file ownership will default to the user
performing the extraction because standard users cannot reassign file
ownership (chown).
Restoring Permissions on Windows (NTFS)
Windows file permissions rely on security descriptors rather than
basic POSIX bits. To restore original file owners and Access Control
Lists, specify the -ow switch during extraction:
unrar x -ow archive.rarFor this to succeed:
- The target drive must use an NTFS filesystem (FAT32 and exFAT do not support NTFS ACLs).
- The terminal or command prompt must be run as an Administrator to grant permission to modify ownership and security descriptors.
Repairing Permissions on Previously Extracted Files
unrar does not include a command to scan existing files
on disk and apply metadata changes without extracting the actual
contents. If a set of files on your system has corrupted or
misconfigured permissions, the standard repair workflow is to force an
overwrite extraction:
unrar x -o+ archive.rarThe -o+ switch instructs unrar to overwrite
existing files unconditionally, replacing the damaged files on disk with
fresh copies that possess the exact permission profiles stored inside
the archive's metadata.