I'm trying to set up an HTTP server on a Debian machine, but my configuration requires a weird setup.

Basically this will be a data storage/retrieval server.

Here is the setup:

  • Two drives (drive1, drive2) mounted as directories in /mnt/data1 and /mnt/data2
  • A dir in each drive, which will be the root for each.
  • A few other directories in those dirs, which will contain data.
  • Four users:
    • userdrive1, which has access to and owns /mnt/data1/root and subsequent directories (root/ is home)
    • userdrive2, which has access to and owns /mnt/data2/root and subsequent directories (root/ is home)
    • pictures, which has /mnt/data2/root/pictures as home directory
    • text, which has /mnt/data2/root/text as home directory

Those four users all belong in the group ftpusers, which has the rights to use an FTP server. /mnt/data2/root/pictures and …/text belong to group ftpusers too, so users pictures and text can write and read files from their home directories, which are otherwise owned by userdrive2.

Everything is working fine for FTP functions. I can view the correct directories, send, read, and delete files as I wish with all.

But I also need to setup an HTTP server to retrieve those files, and I'm having trouble understanding how to do it. I'm using Apache2, with userdir mod enabled, but all I get when browsing http://localhost/~userdrive1, …/userdrive2, …/pictures or …/text (or whatever else actually) is a 403 error (access forbidden). I tried setting user www-data as owner of every directory (chown -R www-data /mnt/drive2/root), but it didn't work either. My Apache server is working, as I can browse http://localhost and get the basic default Apache page.

I must be doing something wrong, and apart from that there's the issue that if I set www-data as owner of all directories, I won't be able to use FTP to send files with my ftpusers.

Can someone enlighten me?

  • Review all <Directory> tags in apache config. You should add either /mnt directory or /mnt/data1/root and /mnt/data2/root with Require all granted – WhiteWind Feb 19 '18 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.