Replace Proton-API-Bridge and go-proton-api with a client in backend/protondrive written against Proton's current Drive API, following the behaviour of Proton's official Drive SDK: - volume-based and v2 routes only - upload block verification, signed manifests and extended attributes - current content encryption (v4 node keys, v6 PKESK, SEIPDv2) - browser (session fork) sign-in, with username and password still supported - the volume's change events, used to keep the metadata cache current and for ChangeNotify, polled at most every 30 s - an in-memory fake Proton server (protontest) so the tests run without an account Uses ProtonMail/gopenpgp/v3 and ProtonMail/go-srp directly; no cgo. Written with heavy AI assistance (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 KiB
title, description, versionIntroduced
| title | description | versionIntroduced |
|---|---|---|
| Proton Drive | Rclone docs for Proton Drive | v1.64.0 |
Proton Drive
Proton Drive is an end-to-end encrypted Swiss vault for your files that protects your data.
This backend reads and writes Proton Drive with the same client-side encryption as Proton's own apps. It is a client of the Proton Drive API written for rclone, following the behaviour of Proton's Drive SDK.
rclone is a third-party application not officially supported by Proton.
Paths are specified as remote:path
Paths may be as deep as required, e.g. remote:directory/subdirectory.
Configuration
There are two ways to sign in:
- With a web browser (the default when no username and password are set). rclone shows a link to Proton's sign-in page, which you can open on any device, including a different computer from the one running rclone. Your password, two-factor authentication and any CAPTCHA are handled by Proton's page; rclone never sees or stores your password.
- With a username and password, for existing configurations and
automated setups. rclone signs in with the
username,password, and, if needed,mailbox_password,2faorotp_secret_keyoptions. If Proton asks for a CAPTCHA, password sign-in fails and you need to runrclone config reconnect remote:and choose browser sign-in.
Either way rclone saves the session in the config file and uses it from then on, refreshing it as needed. The saved session gives full access to your account, so consider encrypting your configuration.
Two uses of a remote set up with environment variables within one rclone command, such as the source and destination of a copy between two of its folders, can't see each other's refresh of the session, so the second to refresh fails with "session expired". A remote in the config file doesn't have this problem.
Here is an example of how to make a remote called remote with browser
sign-in. First run:
rclone config
This will guide you through an interactive setup process:
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> remote
Type of storage to configure.
Choose a number from below, or type in your own value
[snip]
XX / Proton Drive
\ "protondrive"
[snip]
Storage> protondrive
Option username.
The username of your Proton account.
Only needed to sign in with a password. Signing in with a web browser,
which "rclone config" offers, needs neither username nor password.
Enter a value. Press Enter to leave empty.
username>
Option password.
The password of your Proton account.
Only needed to sign in with a password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> n
Option 2fa.
[snip]
2fa>
Option otp_secret_key.
[snip]
y/g/n> n
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Sign in with a web browser?
rclone is a third-party application not officially supported by Proton.
Choose yes to sign in on Proton's sign-in page, on any device; rclone
never sees your password. Choose no to sign in with the username and
password set above.
y) Yes (default)
n) No
y/n> y
Open this link in a web browser, on any device, and sign in to Proton:
https://account.proton.me/desktop/login?app=drive&pv=3#payload=XXXXXXXX
Waiting for the sign-in to complete...
Configuration complete.
Options:
- type: protondrive
[snip]
Keep this "remote" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
The sign-in link contains a secret which lets whoever completes the sign-in hand their session to this rclone, so don't share it. rclone waits up to 10 minutes for the sign-in to complete.
To sign in with a password instead, enter your username and password at
the username and password prompts (and, for a two-password account,
the mailbox_password advanced option), then answer n to "Sign in with
a web browser?". If your account uses two-factor authentication, rclone
asks for a code:
Two-factor authentication code
Enter a value.
config_2fa> 123456
The code is only needed while signing in. If rclone has to sign in again
later without you, for example because the saved session has expired, it
uses the otp_secret_key option to generate a code; without it, or
without a username and password, it stops and asks you to run
rclone config reconnect remote:.
Running rclone config reconnect remote: (or editing the remote) on a
remote which is already signed in asks whether to sign in again; if you
do, the previous session is signed out.
A new account doesn't need to have used Proton Drive before: if the account has no Drive yet, rclone creates it.
Once configured you can then use rclone like this (replace remote with the
name you gave your remote):
List directories in top level of your Proton Drive
rclone lsd remote:
List all the files in your Proton Drive
rclone ls remote:
To copy a local directory to a Proton Drive directory called backup
rclone copy /home/source remote:backup
Modification times and hashes
The modification time of a file is stored, encrypted, with each upload and read back with a precision of 1 second. It can't be changed without uploading the file again, so rclone can't set it on an existing file. The modification time of a folder is set when it is created.
The SHA1 hash algorithm is supported. The hash is the one the uploader recorded in the file's encrypted attributes; files uploaded by clients which don't record one have no hash.
Integrity and signatures
Proton Drive is end-to-end encrypted, and rclone checks what it reads the way Proton's own apps do, so that a server which altered your data would be noticed:
- Every encrypted block of a file is checked against the SHA-256 hash the server lists for it before it is decrypted. A block which doesn't match is downloaded again, up to three attempts in all, then the read fails.
- A read of a whole file first fetches the list of all its blocks and checks the uploader's signature over it (the manifest) before returning any data, so a file can't be truncated, extended or have its blocks reordered. For a very large file this adds about one request per 80 MiB before the first byte arrives.
- The keys of files and folders and the key of each file's content must be signed by their owner.
On upload rclone signs everything it writes, checks that each encrypted block decrypts again before sending it, and, before committing the upload, checks the number of bytes read against the size of the source and the SHA1 of what was read against the source's SHA1 if the source has one.
Ranged reads. A read of only part of a file, as rclone mount,
rclone serve and multi-thread downloads (--multi-thread-streams)
make, checks each block against its listed hash but can't check the
manifest, so a malicious server could serve validly encrypted blocks of
the same file in the wrong place, or from an older version of the same
size. Proton's SDK has the same limit for ranged reads. A range which
covers the whole file is checked as a full read. A file uploaded by a
client which doesn't record its block sizes can only be entered in the
middle as far as earlier reads in the same rclone process have reached:
beyond that a ranged read downloads, checks and discards every block
before the range, which makes it slower. rclone remembers the sizes of
up to 65536 such blocks, so each chunk of a multi-thread download starts
near where an earlier one ended. Its manifest still isn't checked.
Trust is rooted in your own addresses. The share holding your files must have been created, and its root folder signed, by one of your account's addresses, otherwise nothing in the drive is treated as verified. A folder whose key isn't verified makes everything beneath it unverified, even items you signed yourself, because whoever made that key can read and replace what is in it. That includes a genuine folder signed by an address since removed from your account.
By default rclone refuses to:
- read a file whose key, content key or manifest signature doesn't verify, or which is beneath a folder whose key isn't verified;
- update a file whose key or content key signature doesn't verify, as its new content would be encrypted with a key someone else may hold. A content key without a signature counts as one that doesn't verify;
- create, upload, rename, move or copy anything into a folder whose key isn't verified, because what is written there would be encrypted to a key someone else may hold, or whose name hash key's signature doesn't verify, because whoever made that key could test guesses at the names written there;
- rename, move or copy an item whose key isn't verified, because that re-signs it with your keys.
The errors say so and name the ignore_signature_errors advanced option.
Data uploaded by some old or third-party clients, or shared with you by
others, may need it. When it is set, rclone logs an ERROR for each
item and operation it lets through and goes ahead; an item renamed,
moved or copied this way is signed with your keys and trusted from then
on. The option never turns off the block hash checks.
A file or folder name whose signature doesn't verify is listed anyway,
with an ERROR logged, as Proton's apps do.
The modification time, size and SHA-1 of an item whose extended
attributes' signature doesn't verify aren't used unless
ignore_signature_errors is set: rclone logs an ERROR and shows the
server's modification time and no SHA-1. A file's size then comes from
its recorded block sizes, which reads check, or is the encrypted size if
it has none. The file stays readable.
Two limits of the Proton Drive protocol, which Proton's SDK shares, can't be detected by rclone:
- A server which serves a whole earlier version of a file (its blocks, manifest and attributes, all validly signed) in place of the current one.
- Below the root of your drive, an item signed by another Proton user, such as a member of a shared folder, is checked against public keys which the server itself supplies, so a malicious server could forge those.
Restricted filename characters
Names may be at most 255 characters long, counted in UTF-16 code units
as Proton's apps count them (so some emoji count as two), and can't be
empty, . or .., or contain / or NUL. The default encoding replaces
these characters:
| Character | Value | Replacement |
|---|---|---|
| NUL | 0x00 | ␀ |
| / | 0x2F | / |
File names can also not start or end with the following characters. These only get replaced if they are the first or last character in the name:
| Character | Value | Replacement |
|---|---|---|
| SP | 0x20 | ␠ |
Names which are exactly . or .. are replaced with . and ...
Invalid UTF-8 bytes will also be replaced. If the encoding is changed so that they are not, names which aren't valid UTF-8 are refused.
Duplicated files
Proton Drive can't have two files with exactly the same name in the same folder. Uploading a file whose name is already taken by a file adds a new revision to that file, keeping its history, rather than making a second file.
An upload which is cancelled or fails can leave a draft behind. A draft
left by the same remote is replaced on the next upload of that file. A
draft left by another client, which may still be uploading, makes the
upload fail unless the replace_existing_draft advanced option is set.
A remote set up with environment variables or a connection string,
which can't save settings, is told apart by its name and account, so two
machines using such a remote of the same name on the same account count
as the same remote.
If the final step of an upload fails in a way which leaves it unknown
whether the file was saved, rclone reports "upload outcome unknown: it
may have succeeded" and doesn't retry that upload at once; a later run of
rclone sync or rclone copy checks the destination first. The same
goes for "upload committed, but the server doesn't show it yet", which
means Proton accepted the upload but didn't list it within a few
seconds.
Deleting files
Deleted files and folders (rclone delete, rclone purge,
rclone rmdir) are moved to the Proton Drive trash, as Proton has no
direct permanent delete. They count against your storage until the trash
is emptied. rclone cleanup remote: empties the whole trash
permanently, including items deleted with Proton's apps.
rclone rmdir asks the server whether the folder is empty, so it refuses
to remove a folder which holds items rclone doesn't list, such as Proton
Docs or items it can't decrypt.
Items left out of listings
Proton Docs and Sheets have no file content for rclone to read, so they
are left out of listings, with one notice logged. Items whose name or
key can't be decrypted are left out too, each with an ERROR logged.
Mailbox password
If your account uses a separate mailbox
password,
set it in the mailbox_password advanced option to sign in with a
password. Browser sign-in doesn't need it.
Caching
rclone keeps the decrypted metadata of the files and folders it has read
in memory, to save requests and decryption. To turn this off, set the
enable_caching advanced option to false. The cache follows changes
made by other clients, as described below.
Changes made elsewhere
rclone follows the change events of your drive, so it sees changes made by other clients (Proton's apps, or another rclone) while it runs.
- While rclone holds anything in its cache, it asks Proton for new events
every 30 seconds (under a mount or serve, every
--poll-intervalif that is longer). It drops what the events say is out of date and reads it again when next needed. rclone mountandrclone servealso pass the changes on, so a mount shows another client's change within about one--poll-interval(default 1 minute). Values below 30 seconds are raised to 30 seconds. A longer interval is used as it is.- Mounts benefit with
enable_caching = falsetoo: the events still tell the mount which folders to read again. - An idle rclone with nothing cached and no mount or serve makes no event requests. Without a mount or serve, rclone forgets a cache it hasn't used for 10 minutes, so a long-running rclone that has gone quiet stops making them too.
- If rclone has missed too many events, for example after a long time without network, Proton asks it to start over. rclone then forgets everything it has cached and reads it again as it is used. A mount reads its folders again too.
- If the requests fail, rclone waits longer between them, up to 10 minutes, and goes back to the normal interval once they work again.
Logs and --dump
rclone's own log messages for this backend never contain passwords, keys
or tokens, at any -v level. The output of the --dump flags does:
--dump headers shows the x-pm-uid and pm-storage-token headers,
and --dump bodies shows the access, refresh and upload tokens Proton
sends in request and response bodies. Treat --dump output from this
backend as secret, and sign the remote in again (with
rclone config reconnect remote:) if you have shared it.
rclone config create, rclone config show and rclone config dump
print the remote's saved session: the client_ tokens and the salted
key password, which stays valid after signing out until the account
password changes. Don't share that output either.
Standard options
Here are the Standard options specific to protondrive (Proton Drive).
--protondrive-username
The username of your proton account
Properties:
- Config: username
- Env Var: RCLONE_PROTONDRIVE_USERNAME
- Type: string
- Required: true
--protondrive-password
The password of your proton account.
NB Input to this must be obscured - see rclone obscure.
Properties:
- Config: password
- Env Var: RCLONE_PROTONDRIVE_PASSWORD
- Type: string
- Required: true
--protondrive-2fa
The 2FA code
The value can also be provided with --protondrive-2fa=000000
The 2FA code of your proton drive account if the account is set up with two-factor authentication
Properties:
- Config: 2fa
- Env Var: RCLONE_PROTONDRIVE_2FA
- Type: string
- Required: false
--protondrive-otp-secret-key
The OTP secret key
The value can also be provided with --protondrive-otp-secret-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ234567
The OTP secret key of your proton drive account if the account is set up with two-factor authentication
NB Input to this must be obscured - see rclone obscure.
Properties:
- Config: otp_secret_key
- Env Var: RCLONE_PROTONDRIVE_OTP_SECRET_KEY
- Type: string
- Required: false
Advanced options
Here are the Advanced options specific to protondrive (Proton Drive).
--protondrive-mailbox-password
The mailbox password of your two-password proton account.
For more information regarding the mailbox password, please check the following official knowledge base article: https://proton.me/support/the-difference-between-the-mailbox-password-and-login-password
NB Input to this must be obscured - see rclone obscure.
Properties:
- Config: mailbox_password
- Env Var: RCLONE_PROTONDRIVE_MAILBOX_PASSWORD
- Type: string
- Required: false
--protondrive-encoding
The encoding for the backend.
See the encoding section in the overview for more info.
Properties:
- Config: encoding
- Env Var: RCLONE_PROTONDRIVE_ENCODING
- Type: Encoding
- Default: Slash,LeftSpace,RightSpace,InvalidUtf8,Dot
--protondrive-original-file-size
Return the file size before encryption
The size of the encrypted file will be different from (bigger than) the original file size. Unless there is a reason to return the file size after encryption is performed, otherwise, set this option to true, as features like Open() which will need to be supplied with original content size, will fail to operate properly
Properties:
- Config: original_file_size
- Env Var: RCLONE_PROTONDRIVE_ORIGINAL_FILE_SIZE
- Type: bool
- Default: true
--protondrive-app-version
The app version string
The app version string identifies the client that is currently performing
the API request. Third-party Proton Drive integrations should use the form
external-drive-<project>@<version>. If this option is left empty, rclone
derives a compliant value from its own version. This value is sent with
every API request; the option itself is optional.
Properties:
- Config: app_version
- Env Var: RCLONE_PROTONDRIVE_APP_VERSION
- Type: string
- Required: false
--protondrive-replace-existing-draft
Create a new revision when filename conflict is detected
When a file upload is cancelled or failed before completion, a draft will be created and the subsequent upload of the same file to the same location will be reported as a conflict.
The value can also be set by --protondrive-replace-existing-draft=true
If the option is set to true, the draft will be replaced and then the upload operation will restart. If there are other clients also uploading at the same file location at the same time, the behavior is currently unknown. Need to set to true for integration tests. If the option is set to false, an error "a draft exist - usually this means a file is being uploaded at another client, or, there was a failed upload attempt" will be returned, and no upload will happen.
Properties:
- Config: replace_existing_draft
- Env Var: RCLONE_PROTONDRIVE_REPLACE_EXISTING_DRAFT
- Type: bool
- Default: false
--protondrive-enable-caching
Caches the files and folders metadata to reduce API calls
Notice: If you are mounting ProtonDrive as a VFS, please disable this feature, as the current implementation doesn't update or clear the cache when there are external changes.
The files and folders on ProtonDrive are represented as links with keyrings, which can be cached to improve performance and be friendly to the API server.
The cache is currently built for the case when the rclone is the only instance performing operations to the mount point. The event system, which is the proton API system that provides visibility of what has changed on the drive, is yet to be implemented, so updates from other clients won’t be reflected in the cache. Thus, if there are concurrent clients accessing the same mount point, then we might have a problem with caching the stale data.
Properties:
- Config: enable_caching
- Env Var: RCLONE_PROTONDRIVE_ENABLE_CACHING
- Type: bool
- Default: true
--protondrive-description
Description of the remote.
Properties:
- Config: description
- Env Var: RCLONE_PROTONDRIVE_DESCRIPTION
- Type: string
- Required: false
Limitations
- Only the "My files" section of Proton Drive is available; computers backed up with Proton's desktop app, Photos and items shared with you are not.
- Changes made by other clients are seen within about one polling interval, not at once (see Changes made elsewhere).
- rclone metadata (
--metadata) is not supported, and the modification time of an existing file can't be changed without uploading it again. - A file may have at most 524288 blocks of 4 MiB (2 TiB); rclone refuses to read a file which lists more. Items more than 2048 folders deep can't be used.
rclone aboutreports the storage used by your whole Proton account, not only by Drive.- Files are uploaded in blocks of 4 MiB, each held in memory while it is
uploaded: up to 5 blocks of one file at once (the
upload_concurrencyadvanced option, default 4), and at most 10 blocks uploading and 10 downloading at once per remote, so with a high--transferssome transfers wait their turn.