Due to requirements, it was recently necessary to write a small script that encrypts a given folder.
Since a static password didn’t seem reasonable, I wrote a script that generated the password “randomly” and then stored in a KeePass.
The password for this, is fed into a simple file where the respective encrypted string is stored, this is only “per user” – so User 1 gets a different key file than User 2. (Of course, this is only a “simple” protection method, there are quite possibilities to bypass this system (if the user password can be reset, for example, and the user is taken over, everything can also be decrypted.)
The script should be able to encrypt and decrypt as easily as possible, accordingly in the following a short explanation for using the script.