If you’re running a Linux virtual machine or VPS, you may want to mount a WebDAV drive to access and manage your files easily. WebDAV is a protocol that allows remote access to files over the internet, making it ideal for file storage and collaboration.
This tutorial shows you how to configure a WebDAV drive on your Linux VM or VPS.
Step 1: Login your cPanel account. Select Web Disk in the Files section.
Step 2: Create an additional Web Disk account.
Step 3: On your Linux machine, install davfs2 by
sudo apt-get install davfs2 -y
Select No when it asks, ‘Should unprivileged users be allowed to mount WebDAV resources?’ Step 4 Create a folder for Web Disk on your Linux file system.
sudo mkdir /media/webdav
Step 5 Mount your Webdav drive to your device. Replace your_web_disk_domain with your web disk domain and port with your web disk service port
sudo mount -t davfs https://your_web_disk_domain:your_web_disk_domain_port /media/webdav
enter your WebDAV user email password
Step 6: Store your account information used to authenticate in the WebDAV server to davfs2 by
sudo nano /etc/davfs2/secrets
separate each by tab
your_web_disk_domain:your_web_disk_domain_port user_email password
https://xxx.com:2078 [email protected] itsasecretXD
Step 7: Check uid, gid by entering id on the terminal
Step 8: Replace your_web_disk_domain with your web disk domain and port with your web disk service port. Also, replace system_user with the uid you received from step 7 and system_group with the gid you retrieved from step 7.
sudo nano /etc/fstab
your_web_disk_domain:your_web_disk_domain_port /MOUNTPOINT davfs rw,uid=system_user,gid=system_group,file_mode=0660,dir_mode=0770 0 0
https://xxx.com:2078 /media/webdav davfs rw,uid=1000,gid=1000,file_mode=0660,dir_mode=0770 0 0
Restart your device and check if your web disk is reattached to it. You may check it with the following command.
sudo ls -l /media/webdav
If you find your WebDAV folder is not empty, congratulation, your web disk will mount to your device automatically at the start.
The following article will teach you how to sync files between your machine and the web disk.