Mount your Nextcloud account as a catalogue in Linux
In the last couple of month, I have not been able to sync my pretty huge library in Nextcloud due to a bug that is being ignored in the Nextcloud client. But I still need to sync my files – what to do?
It has been a source of frustration to not be able to sync down my files during this fall, so I started to look at other solutions instead, like DavFS2. With DavFS2 you can mount your Nextcloud account like you mount a HDD/SSD ora USB memory – simple!
First of all, you need to install the davfs2 package, on debian derivatives such as Ubuntu, MXLinux or PureOS:
sudo apt-get install davfs2
sudo yum install davfs2
sudo dnf install davfs2
sudo zypper install davfs2
Next, we want to modify the
/etc/fstab file so the Nextcloud account will be mounted at boot, just modify the command provided to match your own setup:
echo "https://cloud.operationtulip.com/remote.php/webdav/ /mnt/nextcloud davfs _netdev,noauto,user,uid=USER,gid=GROUP 0 0" >> /etc/fstab
Also, I do strongly assume that you do not want to enter your login everytime you boot.
echo "/mnt/nextcloud NEXTCLOUDUSER NEXTCLOUDPASSWORD" >> /etc/davfs2/sercets
Let's finish this with adding your user into the davfs2 group
sudo usermod -a -G davfs2 USERNAME
Now, you should be able to mount it:
Optional – encrypt transparently with gocryptfs
First, install the gocryptfs package:
sudo apt-get install gocryptfs
sudo yum install gocryptfs
sudo dnf install gocryptfs
sudo zypper install gocryptfs
In this case, we are just going to create a catalogue in the homecatalogue, add is as a “plain” catalogue where the files is going to be shown decrypted for you and mount it against
/mnt/nextcloud – so the files is going to be stored encrypted.
mkdir -p ~/nextcloud_encrypted gocryptfs -init /mnt/nextcloud gocryptfs /mnt/nextcloud nextcloud_encrypted
Now, you can create a file in
~/nextcloud_encrypted, and it will show up as encrypted in the