This guide explains how to create and configure additional WebDAV folders in Apache for select users and integrate them into Nextcloud as external storage, ensuring folders remain private to specified users.
Step 1: Create a Directory for the New WebDAV Folder
-
Create the folder for the user:
-
Set ownership and permissions for Apache (assuming
www-data
is the Apache user):
Step 2: Create a Password File for Authentication
-
Generate a password file: Replace
username
with the desired user's name. -
Verify the password file:
If you need to add more users, omit the
-c
flag:
Step 3: Configure Apache for the WebDAV Folder
-
Edit your Apache configuration file:
-
Add a new
Alias
and<Directory>
block for the WebDAV folder: -
Save the configuration and exit (
Ctrl+O
, thenCtrl+X
). -
Enable the necessary Apache modules: If not already enabled, run:
-
Test the Apache configuration:
If the output is
Syntax OK
, proceed. -
Restart Apache:
Step 4: Add WebDAV Folder as External Storage in Nextcloud
- Log in to Nextcloud as an admin.
- Navigate to Settings > Admin > External Storages.
- Add the new WebDAV folder:
- Folder Name: Choose a name (e.g.,
folder_name
). - External Storage: Select
WebDAV
. - Authentication: Set to
Username and password
. - Configuration:
- URL:
http://your-server-ip-or-domain/folder_name
- Username:
username
(created in Step 2). - Password: The password you set for the user.
- URL:
- Folder Name: Choose a name (e.g.,
- Available for: Select specific users or groups who should have access to this storage.
- Save the configuration.
Step 5: Test the Configuration
-
Access the WebDAV folder:
- Use a WebDAV client or browser to access:
- Enter the username and password created earlier.
-
Verify access in Nextcloud:
- Log in to Nextcloud as the assigned user.
- Verify that the WebDAV folder appears in the user's external storage and is accessible.
Step 6: Additional Tips
- Separate Folder Permissions: Ensure each WebDAV folder has unique ownership and permissions to prevent unintended access.
- Audit Access Logs: Review Apache access logs to verify users are only accessing their assigned folders:
- Secure Connections: Consider enabling HTTPS for secure WebDAV access. Install an SSL certificate using Let’s Encrypt or another provider.
Example Folder Structure
If you’re managing multiple user-specific WebDAV folders, you can organize them under a common directory:
Each folder can have a unique password file and Apache <Directory>
block.