One of the many things that I enjoy about using Nextcloud is having a trusted space for all of my files to sync across devices. Regardless of which computer I'm using, there's a good chance that everything I want to be present will be present, including all of my bash aliases. Most people that I've spoken to who use Nextcloud or Dropbox to keep files in sync across devices tend to have a dedicated directory just for the application. What I do with Nextcloud is a little different in that I have it sync my entire home directory, including the hidden files and folders. This ensures SSH keys, preferences, and aliases remain in sync, and changing a setting on one machine changes them in all locations. It's a lovely little setup1. That said, it's not the easiest thing to get going thanks to the enforced rules within apparmor
. I'll show you how to get around the problem so that your account's home directory can be completely synchronized with Nextcloud.
What you'll need:
- an up-to-date installation of Ubuntu
- Internet access
- your Nextcloud credentials
How long it'll take:
- 2 minutes, give or take leap seconds
The Nextcloud client is a snap and, as such, must operate within a certain set of rules enforced by apparmor
. Anyone who tries to sync their home account while apparmor
is enabled will get a lovely "unable to initialize sync journal" message. This is because apparmor
will block any snap from writing to /home/{account}
. Some people online will suggest disabling apparmor
, but this defeats the purpose and utility of the application. It's better to leave it in place and change how the Nextcloud client snap is used on the system.
Here's how to get around the problem:
sudo snap remove nextcloud-client
sudo snap install nextcloud-client --devmode
By using the --devmode
option, the snap will be able to operate completely outside the sandbox enforced by apparmor
. Now it will be possible to connect to your Nextcloud instance, enter your credentials, and sync your home directory. One thing you might want to check in advance is the name of the Pictures directory in Nextcloud. By default, it's Photos, while the one in Ubuntu is Pictures. If you'd like both to be the same, I've found it easier to simply set Nextcloud's folder to "Pictures". Once all of the settings are configured to your liking, the sync will start going. Depending on how much data you choose to keep on the client, it may be a good idea to use a wired network connection.
And that's all there is to it!
I understand that there are reasons why some people would not suggest having their entire home directory in sync with a tool like Nextcloud or Dropbox, but this post isn't about why someone shouldn't do it.