Permissions, owners and file attributes
A file is more than its contents. It has an owner, permissions, sometimes an access control list, and often extra data the system keeps alongside it: the Finder information that makes an alias an alias, Finder tags, the “downloaded from the internet” marker, an old resource fork. Nyx Backup records all of it on every backup and gives you two ways to restore it.
This page describes Nyx Backup 1.0.3 and later. For older backups, see Backups made before 1.0.3.
What a backup records
| macOS | Linux | Windows | |
|---|---|---|---|
| Owner and group | yes, with the account names | yes, with the account names | yes, in the security descriptor |
| Permissions | mode bits, including setuid, setgid and sticky | mode bits, including setuid, setgid and sticky | security descriptor: owner, group and access-control entries |
| Access control lists | yes | yes (POSIX ACLs) | yes (part of the descriptor) |
| Extended attributes | yes: Finder info, tags, quarantine, resource forks and the rest | yes: user.*, ACLs, SELinux labels and the rest | - |
| Alternate data streams | - | - | yes, including the “from the internet” marker |
| File flags / attributes | locked, hidden, no-dump, append-only and the system’s flags | - | read-only, hidden, system, archive, not-indexed |
| Modification time | yes | yes | yes |
| Creation time | yes | yes, where the filesystem has one | yes |
| Symbolic links | yes | yes | yes (junctions are kept as symbolic links) |
| Hard links | yes | yes | yes |
This applies to folders as well as files. Large values are kept too: an extended attribute or stream of up to 64 MB is stored encrypted and deduplicated like file data, so a big resource fork costs nothing extra when it has not changed.
A change to any of these is a change. If you only change a file’s permissions, owner, tags or attributes, the next backup records it.
Two kinds of restore
Standard restore: the files become yours
This is what you get by default. Everything comes back as it was, with these exceptions, and the files belong to you, the person restoring:
- Owner: you, whoever owned the file when it was backed up.
- Permissions: as recorded, except setuid and setgid, which are removed.
- Extended attributes: restored, except the ones that grant privilege or
control access (on Linux
security.*,trusted.*andsystem.*, which includes ACLs). - ACLs: not restored. You get the permission bits, without entries that name other people.
- Windows permissions: the file takes the permissions of the folder you restore into, as a newly created file would.
Your Finder aliases, tags, resource forks, hidden and locked flags, Windows attributes and “from the internet” markers all come back with a standard restore. You do not need administrator rights for any of it.
The restore is also carried out with your own rights. It cannot write into a folder you could not write to yourself, replace another user’s files, or place anything in system folders. This keeps a restore from being used to get access you do not already have.
Original owners and permissions: put everything back as it was
Use this to restore other people’s files, a shared folder, or a whole computer. It puts back:
- the original owner and group of every file and folder;
- the permissions as recorded, setuid and setgid included;
- all extended attributes and ACLs;
- on Windows, the full security descriptor: owner, group and every access-control entry;
- on macOS, all file flags, including the system’s.
This needs an administrator, because only an administrator can give files to other people or set these permissions (see Why it needs an administrator). To ask for it:
- In the app: on the Restore tab, tick Restore original owners and permissions before you start. Your computer asks for an administrator’s password: the standard password dialog on macOS, the system prompt on Linux, and UAC on Windows. On Windows a standard user can type an administrator’s name and password in that prompt. The approval covers that one restore.
- In the terminal app: press
oin the destination picker. - From the command line:
- macOS and Linux:
sudo nyx_bkp_cli restore "My set" /restore/here --preserve-owners - Windows: the same command, without
sudo, from a terminal opened with Run as administrator.
- macOS and Linux:
A restore that asks for original owners without an administrator’s approval is refused before anything is written.
Scenarios
Getting your own files back
Use a standard restore. Your files come back with their contents, dates, permissions, tags, aliases and attributes, owned by you.
Restoring another user’s files, or a shared folder, on the same computer
Use original owners and permissions. Each file returns to the person who owned it, with its permissions and ACLs as they were. If the backup was made on this computer, owners are put back exactly as recorded.
Recovering a whole computer
Nyx Backup backs up files and folders, not a bootable image of the disk. To recover a computer:
- Install the operating system.
- Create the user accounts, with the same names as before. They do not need the same numeric ids or Windows SIDs.
- Install Nyx Backup and connect to your backup with your recovery passphrase (see Restoring files).
- Restore with original owners and permissions.
Every file goes back to the account of the same name, with its permissions, ACLs and attributes.
Moving to a new computer, or one where the accounts differ
Account numbers are not portable. The first account on every Mac is number 501, and every Windows PC gives its accounts different SIDs. So when you restore original owners onto a different computer, Nyx Backup matches owners by account name, using the names it recorded at backup.
| What was recorded | What happens on the new computer |
|---|---|
| Owner or group whose name exists here | Given to that account, whatever its number is here. |
| Name does not exist here, and its old number is not in use | Keeps its old number. |
| Name does not exist here, and its old number belongs to someone else | Given to you instead, so it never lands on a stranger’s account. The restore summary counts these. |
| An ACL entry naming a user or group that does not exist here | Left out. It is never kept by number, which would grant or deny access to whoever later receives that number. The rest of the ACL is kept. |
| Windows: an account in the security descriptor | Replaced by the account of the same name on this PC. An owner with no such account becomes you. |
If you know the accounts on both computers have the same numbers, for example
Linux servers that share a directory service, add --numeric-owner to the
command line to apply the recorded numbers as they are, without matching
names.
Restoring to a USB drive, memory card or network share
Drives formatted FAT or exFAT, and many network shares, cannot store owners, permissions, extended attributes or streams. The file contents restore in full, and the restore summary tells you how many items were restored without their attributes because the destination cannot hold them. To keep everything, restore to a disk formatted for your system: APFS or Mac OS Extended on a Mac, NTFS on Windows, and ext4, XFS or Btrfs on Linux.
On macOS, an external drive can be set to Ignore ownership on this volume (in Finder, Get Info). macOS then treats every file on it as belonging to whoever is using it, so owners restored there will not show. Clear that setting before an original-owners restore to that drive.
Restoring on a different operating system
You can restore any backup on any platform. The contents always come back in full; how much else comes back depends on what the destination can hold.
| Backed up on | Restored on | What comes back besides contents and dates |
|---|---|---|
| macOS | Linux | Permissions, and owners with an original-owners restore. Attributes that have a Linux equivalent are written; Apple-specific attributes, macOS ACLs and file flags have none and are counted as not supported. |
| Linux | macOS | Permissions, owners with an original-owners restore, and user.* attributes under the same names. Linux ACLs have no macOS equivalent. |
| macOS or Linux | Windows | Nothing more. The files belong to you and take the folder’s permissions. |
| Windows | macOS or Linux | Nothing more. The files belong to you with default permissions. |
What does not cross is not lost: it stays in the backup, and a restore to the platform it came from brings it back. In practice:
- Finder tags, aliases, resource forks and the “downloaded from the internet” marker of a Mac file do not come back on Windows, and most of them not on Linux either, which has no place for Apple’s attributes.
- Windows attributes (hidden, read-only, system) and alternate data streams, such as the “downloaded from the internet” marker, do not come back on a Mac or Linux.
- A link comes back pointing at the same path text it always had. A Windows
link to
C:\Users\...restored on a Mac, or a Mac link to/Users/...restored on Windows, points at a path that does not exist there. - The restore summary counts the items whose attributes the destination could not hold, so nothing is dropped without being reported.
Finder aliases, tags and resource forks
These are extended attributes and come back with any restore to a Mac. Restoring to a Mac drive (APFS or Mac OS Extended) keeps them; a FAT, exFAT or Windows-formatted drive cannot.
Links
- Symbolic links are recreated as links, pointing exactly where they pointed before. A restore never follows a link, so a link cannot redirect where restored files are written.
- On Windows, a symbolic link is restored as a link wherever you could
create a file yourself, even if your account is not allowed to create links
(Developer Mode, or the right granted by an administrator). Where no link
can be made, a small
name.symlink.txtfile holding the link’s target is restored in its place. - Junctions and folder links (Windows) are backed up as links, never followed, so the folder they point to is backed up only if it is itself inside what you back up. They come back as the same kind: a junction as a junction, a folder link as a folder link, both opening as the folder they point to. A junction needs no special rights to restore. Backups made before 1.0.4 did not record which kind a link was; restoring one of those makes a folder link when the folder it points to exists.
- Hard links (several names for one file) are restored as one file with all its names again. On a drive that cannot hold hard links, such as exFAT, each name becomes its own copy.
Why it needs an administrator
The Nyx Backup service runs with full system rights, so that it can read every file it backs up. Any user on the computer can ask it to restore. If it put back original owners for anyone who asked, a standard user could use it to do things only an administrator may do: give files to other people, put a setuid program owned by the administrator account back into a folder they control, restore privilege-granting attributes, or bring back an old copy of a system settings file from a time when they had more rights.
The operating system reserves these actions for administrators, and Nyx Backup follows the same rule. A standard restore needs no approval because it can only do what you could already do. The approval for an original-owners restore is for one restore only and expires after a few minutes, so it cannot be reused later.
What the restore summary tells you
When a restore finishes, the app (and the command line) tells you, if any:
- how many owner, permission, date or attribute changes could not be applied. The file contents are complete; only that detail is missing;
- how many items were restored without attributes because the destination cannot hold them;
- how many recorded users or groups do not exist on this computer, and were given to you instead.
The service log lists examples of each, and every owner that was matched by name.
Good to know
- Not backed up: named pipes, sockets and device files; Windows cloud placeholders and offline files (so they are not downloaded just to be backed up); and the auditing part of a Windows security descriptor.
- Creation dates cannot be set on Linux; macOS and Windows get them back.
- Symbolic links keep their owner and attributes, but not their own permissions or modification date.
- System-managed attributes on macOS (such as
com.apple.provenanceandcom.apple.macl) belong to macOS and are never written back. - Finder comments are kept from version 1.0.6. Finder stores them in the
folder’s hidden
.DS_Storefile rather than on the file itself, and from 1.0.6.DS_Storeis backed up, so a restored folder also gets back its Finder view settings and icon positions. Earlier versions left.DS_Storeout. Tags are kept in every version. - Values over 64 MB in a single attribute or stream are not kept; the backup warns and names a few of them.
- The Recovery Tool restores file contents only for now. It does not yet put back owners, permissions or attributes; use the app for that.
Backups made before 1.0.3
Snapshots taken before 1.0.3 recorded only each file’s permission bits and numeric owner. They have no account names, no folder permissions, no attributes or ACLs, no Windows security information, and no hard links. A restore puts back what they hold and nothing more. Restoring original owners from one of them onto a different computer gives every file to you, because there are no names to match.
The first backup after you update to 1.0.3 records a new snapshot with everything on this page, even if no files changed. File contents are not uploaded again.