How to sync KeePassium with Google Drive

Setup

  1. Install Google Drive app and login into your account
  2. Open KeePassium
    • If the app was just installed, tap Add Existing Database
    • If you already have other databases, tap + and choose Open Database
  3. If Google Drive is not visible in the list, make it visible
  4. Select your database file
  5. That’s it!

Troubleshooting

Does not work offline

Google Drive does not work offline, even if the database file was “Made available offline”.

As a workaround, you can open Google Drive app, select your database, press Open In and then Copy to KeePassium. This will create a local in-app copy of the database, that will not be synchronized with Google Drive. To share any offline changes, you will need to export the database back to Google Drive.

“Unsupported file type” when selecting a database

This is caused by the Privacy Screen in Google Drive. This feature blocks access to files from other apps, such as KeePassium. When you open a file selection dialog in KeePassium, the system shows “Authentication required”. When you tap “Open Google Drive” in that dialog — you switch from KeePassium to Google Drive app. When you select a database, Google Drive complains it does not know anything about .kdbx files.

The solution is to turn off the Privacy Screen in Google Drive settings.

Google Drive does not respond

This often happens after you add your database to KeePassium and then enable the Privacy Screen in Google Drive. The Privacy Screen blocks access to Google Drive files from other apps. As a result, Google Drive does not respond to KeePassium’s attempts to read the database.

The solution is to turn off the Privacy Screen in Google Drive settings.

Limitations for shared files

Google Drive does not expose shared files to the Files app, so they cannot be added to KeePassium directly.

Partial workaround: Google Drive app → Shared button for the shared file → Add shortcut to Drive. This will make the database accessible to the file system, Files, and KeePassium. Unfortunately, shortcuts seem to be read-only, so KeePassium will not be able to save the database.

FUSE filesystem over Google Drive (google-drive-ocamlfuse)

If you use google-drive-ocamlfuse with KeePassXC, KeePassium might often complain that Google Drive does not respond. The detailed diagnostic info shows that the database file has been deleted:

Failed to access the file [
	fileProvider: com.google.Drive.FileProviderExtension, 
	systemError: 
		Error Domain=NSCocoaErrorDomain 
		Code=4101 "Geen communicatie mogelijk met een helperapp." 
		UserInfo={
			NSUnderlyingError=0x1234ABCD {
				Error Domain=trash 
				Code=0 "(null)"
			}
		}
]
The reason is that google-drive-ocamlfuse creates a new file ID when KeePassXC saves the database. Since KeePassium tries to access the database using an old reference, Google Drive repots that the old file has been deleted.

The solution is to open ~/.gdfuse/default/config and set mv_keep_target=true.


See also

Last Updated: 2021-05-23