Hi there, Iâm on Bazzite KDE and recently somehow lost a my âgamingâ folderâŠ? No idea how but must gave been user faulty, e.g me. Therefore wondering if itâs possible to lock certain folders so that this cannot accidentally happen?
Can you give ownership of it to someone else?
People have already given direct answers, and the indirect answer of âset up regular automated backupsâ (which everyone should set up right now if they havenât already), but for the sake of throwing another option out there, people could take a look at âtrash-cliâ: https://github.com/andreafrancia/trash-cli
(P.S. I know OP might not have actually deleted the files with ârmâ, but this addresses a broadly similar issue.)
Btrfs, snapper, cp --reflink stuff back out of a snapshot.
Others have answered your question - but it may be worth pointing out the obvious - backups. Annoyances such as you describe are much less of a stress if you know youâre protected - not just against accidental erasure, but malicious damage and technical failure.
Some people think itâs a lot of bother to do backups, but it is very easily automated with any of the very good free tools around (backup-manager, someoneâs mentioned timeshift, and about a million others). A little time spent planning decent backups now will pay you back one day in spades, itâs a genuine investment of time. And once set up, with some basic monitoring to ensure theyâre working and the odd manual check once in a blue moon, youâll never be in this position again. Linux comes ahead here in that the performance impact from automated backups can be prioritised not to impact your main usage, if the machine isnât on all the time.
Definitely a very valid point! I have a server I can back up to aswell, just gotta set it up as you say đ
I think itâs worth emphasising here: Donât put it off!
There are millions who can tell you from experience that good intentions count for nothing when it comes to backups.
Iâd recommend going and setting up Timeshift right now: https://github.com/linuxmint/timeshift
Itâs easy to set up, it takes literally 10 minutes, and if you decide later you want to use something else, you can just uninstall Timeshift and delete its backups. But in the meantime youâll be protected with backups.
Itâs literally the first thing I install on a new system and itâs saved me multiple times from having to do a complete reinstall.
+1 to this.
You can reduce likelihood of any known risk with a preventative measure, in this case the permissions and ownership structure. That is good.
Backup does not reduce likelihood of risk.
It does something more wide-reaching, it mitigates against the bad outcome of loss (from most causes).So it defends from many unknown risks as well as known ones, and unexpected failure of preventative measures. It sort of protects you from your own ignorance and complacency.
Shit - iâm off to do some more work on backup.sh.
If you have the space (on a different drive, preferably) you could use Timeshift to create regular snapshots of (parts of) your system. You can restore deleted files like this from even months ago, if you configure it like that.
The first snapshot takes up as much space as all the files you want to save, but every following one only uses as much disk space as the new/changed files since the last snapshot.