2

I need to encrypt the folder /var/www/test.

The folder contains PHP files. The goal it to prevent any user to read the php content AND if the HD is mounted on another computer, the /var/www/test should be encrypted AND if computer booted up without any user logged I would like anyone to be able to access data in /var/www/tests.

What is the correct approach for this?

I've tried "ecryptfs-setup-private" as advised in How to encrypt /var/www? yet it didn't work for me. I've might missed something - I've tested the folders while booting with ubuntu 12.04 installation disk and mounted the drive, than I was able to access /var/www/test content.. yet this is what I want to prevent.

The gnome-encfs isn't the way to go since its decryption happens when users logs on to the system & I would like the system to be working after power failure etc' without any one logged in.

Please advice.

1 Answers1

2

I found a way to encrypt the folder. it works by encrypting /var/www, then you mount it in a different location. example:

I mount the encrypted /var/www, and I have to add files by putting them in /home/jmartin/mounted

As far a making it not visible if the drive is mount via livecd or another computer? you would need to have your partition setup as an encrypted LVM. this must be done at the time of installation. Its a clear choice when installing server, use this guide for desktop: http://ubuntuforums.org/showthread.php?t=1782296

back to encrypting your folder. open a terminal and type:

sudo apt-get update && sudo apt-get upgrade

its a good idea to update before doing anything new. next type

sudo apt-get install encfs

this will install encfs, an encryption tool. next:

sudo encfs /var/www home/USERNAME/mounted

the first location is what you are encrypting, the second is what where you will access it. use your username where it says "USERNAME".

to unmount the visible location:

sudo ifusermount -u home/USERNAME/mounted

to unlock and mount:

sudo encfs /var/www home/USERNAME/mounted

hope this helps! more info: https://help.ubuntu.com/community/FolderEncryption