mikronod

Syncing KeePass between Linux and Android using Nextcloud

My solution for syncing KeePass between Linux with KeePassXC and Android with KeePassDX using Nextcloud. (Works with KeePassium / Strongbox on iPhone too).

My Linux desktop computer is also acting as a server running Incus, and one container is my Nextcloud server.

I have created a folder ~/nextcloud where my keepass.kdbx is located.

KeePassXC is using this file directly and since it's a local file it's always accessible (even if Nextcloud is not running).

I have mounted ~/nextcloud inside the Incus Nextcloud container as /data.

In Nextcloud I have monuted /data as a folder for my Nextcloud user.

On my Android phone I have installed the Nextcloud app.

In KeePassDX I have choosed to open an existing database where I navigated to the Nextcloud storage and choosed my keepass.kdbx.
(For iPhone in KeePassium / Strongbox you can set it up to use WebDAV to the Nextcloud server and then choose the keepass.kdbx file).

This way I can also easily share any file between Linux and an iPhone if needed.



If your Nextcloud is hosted on a VPS or any other non local server, then you can instead do this.

Install dav2fs. When asked if normal users should be allowed to mount, choose yes.

Add a row last in /etc/fstab:

https://nextcloud.example.com/remote.php/dav/files/nextcloudusername /home/linuxusername/nextcloud davfs rw,auto,user,uid=linuxusername,gid=linuxgroupname,_netdev 0 0

Add linuxusername to the group dav2fs.

Add a row last in /etc/davfs2/secrets:

/home/linuxusername/nextcloud linuxusername nextcloudusernamePasswordForNextcloud

Mount the folder with mount /home/linuxusername/nextcloud.

KeePass, KeePassXC, KeePassDX, Linux, Nextcloud, Android