Accessing Nextcloud files using WebDAV

Mapping a network drive in Windows

Go to the Start menu and click on ‘Computer’.

When the ‘Computer’ file browser window opens, then click on ‘Map network drive’.

A window will appear asking you to choose a drive letter for the network drive (any drive letter not currently in use will work) and supply the address of the network folder.

In my case it was https://drive.kloud.com.bd/remote.php/dav/files/USERNAME/

Make sure the ‘Reconnect at logon’ and ‘Connect using different credentials’ boxes are ticked below the folder address, then click on the ‘Finish’ button.

You will be promted for the cloud username and password that were set for your account.

Enter the username and password that you use to log into the NextCloud web interface. If you wish to save the password on your computer so that you don’t have to enter it each time the computer establishes a connection with the server, then you can tick the ‘Remember my credentials’ box. Then click the ‘OK’ button. If the details you’ve entered are correct, then all the files from your cloud account will then be available under the new drive letter.

Accessing files using Linux

You can access files in Linux operating systems using the following methods.

Nautilus file manager
Use the davs:// protocol to connect the Nautilus file manager to your Nextcloud share:

davs://example.com/nextcloud/remote.php/dav/files/USERNAME/

Note

If your server connection is not HTTPS-secured, use dav:// instead of davs://.

Accessing files with KDE and Dolphin file manager
To access your Nextcloud files using the Dolphin file manager in KDE, use the webdav:// protocol:

webdav://example.com/nextcloud/remote.php/dav/files/USERNAME/

You can create a permanent link to your Nextcloud server:

  • Open Dolphin and click “Network” in the left hand “Places” column.
  • Click on the icon labeled Add a Network Folder. The resulting dialog should appear with WebDAV already selected.
    If WebDAV is not selected, select it.
  • Click Next.
  • Enter the following settings:Name: The name you want to see in the Places bookmark, for example Nextcloud.
  • User: The Nextcloud username you used to log in, for example admin.
  • Server: The Nextcloud domain name, for example example.com (without http:// before or directories afterwards).
  • Folder – Enter the path nextcloud/remote.php/dav/files/USERNAME/.
  • (Optional) Check the “Create icon checkbox” for a bookmark to appear in the Places column.
  • (Optional) Provide any special settings or an SSL certificate in the “Port & Encrypted” checkbox.

Creating WebDAV mounts on the Linux command line

You can create WebDAV mounts from the Linux command line. This is useful if you prefer to access Nextcloud the same way as any other remote filesystem mount. The following example shows how to create a personal mount and have it mounted automatically every time you log in to your Linux computer.

Install the davfs2 WebDAV filesystem driver, which allows you to mount WebDAV shares just like any other remote filesystem. Use this command to install it on Debian/Ubuntu:

apt-get install davfs2

Use this command to install it on CentOS, Fedora, and openSUSE:

yum install davfs2

Add yourself to the davfs2 group:

usermod -aG davfs2 <username>

Then create a nextcloud directory in your home directory for the mountpoint, and .davfs2/ for your personal configuration file:

mkdir ~/nextcloud
mkdir ~/.davfs2

Copy /etc/davfs2/secrets to ~/.davfs2:

cp /etc/davfs2/secrets ~/.davfs2/secrets

Set yourself as the owner and make the permissions read-write owner only:

chown <linux_username>:<linux_username> ~/.davfs2/secrets
chmod 600 ~/.davfs2/secrets

Add your Nextcloud login credentials to the end of the secrets file, using your Nextcloud server URL and your Nextcloud username and password:

https://example.com/nextcloud/remote.php/dav/files/USERNAME/ <username> <password>
or
$PathToMountPoint $USERNAME $PASSWORD

for example

/home/user/nextcloud john 1234

Add the mount information to /etc/fstab:

https://example.com/nextcloud/remote.php/dav/files/USERNAME/ /home/<linux_username>/nextcloud
davfs user,rw,auto 0 0

Then test that it mounts and authenticates by running the following command. If you set it up correctly you won’t need root permissions:

mount ~/nextcloud

You should also be able to unmount it:

umount ~/nextcloud

Now every time you login to your Linux system your Nextcloud share should automatically mount via WebDAV in your ~/nextcloud directory. If you prefer to mount it manually, change auto to noauto in /etc/fstab.

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.