Snapshot and restore filesystem ownership & permissions.
chguard --save /srv/app --name app-baseline
chguard --list
chguard --restore app-baseline
chguard --restore app-baseline --dry-run
chguard --restore app-baseline --permissions
chguard --restore app-baseline --owner
chguard -- chown user:group /srv/app/config.yml
Use -- to wrap a metadata-changing command. chguard auto-snapshots first (auto-YYYYMMDD-HHMMSS).
chguard -- chmod 755 /srv/app/bin/start
chguard -- chown app:app /srv/app/config.yml
chmod, chown, chgrp.chguard wrapper mode for convenience.Everything for this tool on one page: options, behaviour notes, and copy-paste examples.
chguard does not run sudo internally. If you need privileges, run it with sudo explicitly.
# take snapshot as root when the tree includes root-owned files
sudo chguard --save /srv/app --name app-baseline
Snapshots are stored in a local SQLite database containing:
Usernames and permission strings are resolved only for display.
Record uid/gid and mode for files and directories under a path.
chguard --save /srv/app --name app-baseline
chguard --list
Output includes snapshot name, path, and timestamp.
Restore always previews a diff table first, then prompts once at the end (default No).
chguard --restore app-baseline
Choose what kind of metadata to restore.
chguard --restore app-baseline # owner + perms (default)
chguard --restore app-baseline --permissions
chguard --restore app-baseline --owner
chguard --restore app-baseline --dry-run