Hi


I want to encrypt my folders for mysql-database and apache2-webserver and see 2 possibilities.
Encrypted folder with ecryptfs and moving the folders to my crypted extern hdd.
My system is a rpi3 with ubuntu server 16.04.


I tried 3 following ways, all without success.


#1
add one other user with "adduser --encrypt-home x" and store both folders in the new home directory, giving rights and access to them and update folder paths to mysql and apache configs.
Unfortunately the user isn't only logged out with "exit" in terminal, but also the home directory will then umount and all setup is broken. With a new "su x" the home is mounted again, yes, but that doenst help.
With a manually "ecryptfs-mount-private" (or similar) the home should be mounted, but that comes to an error message telling me that "setup wasnt done properly" or similar. The error already known by many users on the internet and bug reports, but all without solutions


#2
encrypting a new folder to store the mysql and apache folder (without user link). Unfortunately the command "sudo mount.ecryptfs /.folder /folder" comes with the error "Unable to find a list of options to parse, defaulting to interactive mount". Maybe thats the result of my first try to encrypt the folder, but just with a missing point in first path, so I deleted the folder after first success and then the error came.


#3
Moving both folder to the encrypted hdd and use symbolcc links to original paths, giving access and rights to the new location. Theoretical ok, but really a problem, because the root user for mounted folder is a different user, so mysql and www-data have to be a group member of that user. Thats done, but mysql-servie doesnt understand this and gives me error message to not have access to the root folder "/var/lib/mysql" (symbolic link).
As a conslusion, the two differences to default status is first the symbolic link (transparent, so doesnt matter) and second the user access to the root folder containing new mysql and new www folder.


In my understanding both programs need service-root folder in first level under root folder as to see in "/var/www" for apache2 and "/var/lib/mysql" for mysql... but oops mysql is the 3rd level, thats crazy.


So where are my problems, solution possible?
Please help


Thanks, kasper