NextCloud as cloud storage on Linux

Setup webdav nextcloud filesystem mapping on Linux

Adapted from the official NextCloud instructions:

Shell commands to perform (as your regular user):
Note: replace all occurrences of adjective-noun below with your server’s unique adjective-noun combination indicated in its adjective-noun.local hostname. Replace NCUSERNAME with your NextCloud username, NCPASSWORD with that NextCloud user’s password, and YOURLINUXUSERNAME with your linux username.

sudo apt install avahi-daemon davfs2
usermod -aG davfs2 $USER
mkdir /home/$USER/NextCloud-adjective-noun
chown -R $USER:$USER ~/.davfs
chmod 600 ~/.davfs/secrets
chmod 700 ~/.davfs
echo "/home/$USER/NextCloud-adjective-noun NCUSERNAME NCPASSWORD" >> ~/.davfs/secrets

Copy your cert from System > Root CA into /etc/davfs2/certs/ and then put:
trust_ca_cert /etc/davfs2/certs/adjective-noun.crt
Into: /etc/davfs2/davfs2.conf

Add to /etc/fstab:

#nextcloud webdav folder
https://yournextcloudservice.local/remote.php/dav/files/NCUSERNAME/ /home/YOURLINUXUSERNAME/NextCloud-adjective-noun davfs user,rw,auto 0 0

Then reboot and it should mount at boot.

1 Like

Thanks for the guide.

Also just a side note, that if You run an only cli install, like i did, you will have to also manually install avahi daemon for the .local domain name resolution to work. You can achieve this on debian based distros with the following command:

# apt install avahi-daemon

This package should be available on most Debian installs by default. Occasionally, it is also necessary to get the avahi-dnsconfd package, and start/enable it.