A lightweight tool to backup and restore file and directory permissions in Linux.
- Backup Permissions: Save the permissions of all files and directories in a specified path to a portable file.
- Restore Permissions: Restore permissions from a backup file to ensure consistency across systems.
When transferring files or setting up backups, permissions can be altered or lost. fs-perm-backup
helps:
- Safeguard permissions during data migrations.
- Restore permissions after accidental changes.
To install fs-perm-backup
, follow these steps:
-
Clone the repository:
git clone https://github.com/titangmz/fs-perm-backup.git cd fs-perm-backup
-
Build the project:
go build ./cmd/fs-perm-backup.go
-
Add the binary to your PATH:
sudo mv fs-perm-backup /usr/local/bin
The fs-perm-backup tool provides two main operations: backup and restore file permissions.
# Using positional arguments fs-perm-backup backup <target-path> <backup-file> # Using short flags fs-perm-backup -m backup -t <target-path> -b <backup-file> # Using long flags fs-perm-backup --mode backup --target <target-path> --backup-file <backup-file>
# Using positional arguments fs-perm-backup backup ./myproject perms.json # Using short flags fs-perm-backup -m restore -t ./myproject -b perms.json # Using long flags fs-perm-backup --mode backup --target /var/www/html --backup-file site-perms.json
- Backup files are stored in JSON format
- Requires appropriate permissions to read/write target paths
- Supports both flag-style and positional argument syntax
Contributions are welcome! Feel free to submit issues, feature requests, or pull requests. Follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit changes:
git commit -m 'Add new feature'
- Push to your branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License.