Skip to main content

fake-super icon

Fake-super — A tool to save/restore rsync --fake-super attributes

pipeline status coverage report

--fake-super is one of the coolest options of the rsync remote file synchronization tool. It is especially useful when sending system-level backups to a remote backup server, on which the backup client should not have system (root) permission, but

  • permissions (including setuid/setgid bits),
  • information about owners and groups,
  • access control lists (ACLs), or
  • special files, i.e.
    • symbolic links,
    • character/block devices,
    • Unix domain sockets, and
    • FIFOs/named pipes

on the origin system should be accurately preserved. Such a backup setup is especially useful when trying to prevent against the backup being tampered or destroyed maliciously, such as an intruder or ransomware.

When restoring back to the origin system, everything is fine. However, if — e.g. in the case of disaster recovery — the backup system is to be used as a replacement for the origin system, all the above information are lacking.

fake-super allows you to restore the attributes from the user.rsync.* extended attributes, where rsync --fake-super stores the information, back to the real information.

Extended attribute format

user.rsync.%stat

A single line (without EOL) with the following space-separated fields:

  • mode (octal) as specified in inode(7)
  • device information as a comma-separated tuple of major, minor IDs. Block and character devices are differentiated by the S_IFMT bits in the mode above.
  • ownership information as a colon-separated tuple of numeric user and group IDs.

An example for a plain file with mode rw-rw-r--:

100664 0,0 1000:1000
^^ S_IFMT information (S_IFREG, regular file)
  ^ Setuid/setgid/sticky bits
   ^^^ regular permission bits
       ^^^ Device ID (0, not used for regular files)
           ^^^ UID/GID of the original file (user/group 1000)

/dev/null from Linux would be annotated as follows:

060666 1,3 0:0
^^ S_IFBLK, block device
   ^^^ R/W for everyone
       ^^^ Device ID 1,3
           ^^^ Belonging to root

Security considerations

  1. Using this program grants the unprivileged creator of the original files posthumously essentially the same rights as a process running as root would have had.

    :warning: Only run this program if you trust the creator of the files ultimately and can be sure the files have not been tampered with.

  2. Specifying user or group as -1 (or anything that equals to -1 when cast to a uid_t or gid_t, depending on your OS this could be any multiple of 65536 (2^16) or 4294967296 (2^32) minus 1) will leave the owner or group unchanged. This is a limitation of the chown() system call. Under some circumstances, this could also be turned into a security problem, but as you have to trust the creator of the files fully anyway (see item 1 above), this probably does not make a difference in most use cases.

Metadata

Release files for fake-super 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fake-super 0.2.1
File Size Uploaded
fake-super-0.2.1.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fake-super 0.2.1
File Interpreter ABI Platform
fake_super-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.4 kB

Release files / fake-super-0.2.1.tar.gz

Download URL fake-super-0.2.1.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6f6e35bd26fb25783a408dacf465fa04a94a2e77b2b0c7419da8a2fa9df8ae26
BLAKE2b-256 checksum
How to use checksums
200330089660a8dced1495b7d5ea513cb34ab2400e1d7680f171d15e889c15d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.4.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7

Release files / fake_super-0.2.1-py3-none-any.whl

Download URL fake_super-0.2.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b9ea39b9ae25a3efe8c741f3dd83535cd5bbcd61d93ca54bcdea87f2dc4c797
BLAKE2b-256 checksum
How to use checksums
e31a844f33d9b898fb05903f9493374429db2b1c057e2f7fd7e838c575440477
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.4.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page