https://github.com/cedws/saferm
Utility for intercepting C standard library calls to delete files, instead moving them to a trash directory.
https://github.com/cedws/saferm
linux utility
Last synced: about 1 month ago
JSON representation
Utility for intercepting C standard library calls to delete files, instead moving them to a trash directory.
- Host: GitHub
- URL: https://github.com/cedws/saferm
- Owner: cedws
- License: gpl-3.0
- Created: 2019-11-23T21:53:12.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-03T23:25:24.000Z (about 5 years ago)
- Last Synced: 2025-03-02T00:59:23.087Z (over 1 year ago)
- Topics: linux, utility
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# saferm
Utility for intercepting C standard library calls to delete files, instead moving them to the `Trash` directory. This is achieved via `LD_PRELOAD`. This can prevent an accidental `rm` or software bug from becoming a disaster.
**This is just an experiment for now. Use at your own risk.**
## Limitations
- Can only prevent dynamically linked executables from truly deleting your files
- Only supports Linux (macOS support might be possible but difficult, due to runtime hardening)
## Usage
- Run `make`
- Configure your shell to export `LD_PRELOAD` with the path to the built shared object:
- Bash: add to `~/.profile`:
```
export LD_PRELOAD=full/path/to/saferm.so
```
- Fish: add to `~/.config/fish/config.fish`:
```
set -x LD_PRELOAD full/path/to/saferm.so
```
- Reload your shell configuration with `source`