What is ‘bindfs’?
A FUSE filesystem for mirroring the contents of a directory to another directory. Additionally, one can change the permissions of files in the mirrored directory.
Simple Usage of ‘bindfs’
Upload your files to your home directory [/home/gatekeeper/www/html] on your server with your account user name [gatekeeper], and ‘bindfs’ will copy your files to your Apache server root directory [/var/www/html] with your Apache user name [www-data]. While copying files, your file ownership changes to your Apache user name automatically.
I am assuming your server root folder address is [/var/www/html] in this installation guide. If your server root folder location is different, you need to replace it with yours. In addition, you need to replace ‘gatekeeper’ with your server account user name.
root@talkerland $ apt -y install bindfs
root@talkerland $ mkdir -p /home/gatekeeper/www/html
root@talkerland $ chown -Rf gatekeeper:gatekeeper /home/gatekeeper/www
root@talkerland $ chmod -Rf 770 /home/gatekeeper/www
root@talkerland $ nano /etc/fstab
Add the following sentence and save the ‘fstab’ file. It is used to set File Permission to 644 and Folder Permission to 755. Make sure to add it in one line. Do not wrap it.
Mount the folder now.