Secure Setup For Proton Drive on Linux

Leduccc
5 min read1 day ago

--

Proton Drive

As of February 2025, Proton doesn’t yet provide a client for Linux but luckily, the fine folks at RClone reverse-engineered the Proton Drive API and now kindly provide a backend that we can use to set up a mount.

Other solutions such as S3Drive, which costs money, Celeste and RClone Shuttle provide an easy way to setup Proton Drive however they do not use RClone config encryption which means that your Proton email and password are stored in plaintext on your PC which is completely unacceptable.

Our solution will use your OS’s keyring. The keyring is a secure storage system for passwords. Different Linux distributions use different backends (GNOME Keyring, KWallet, etc.).

In this quick guide we will securely setup Proton Drive on linux with the following requirements:

  • Proton Drive will mount at boot
  • It will be managed via Systemd if available
  • The config encryption password will be stored in the keyring and managed via python-keyring.
  • The user will be prompted to enter their keyring password on boot

Prerequisites

  • Python3
  • PIP

Installing Dependencies

As of the writing of this guide, the Proton backend is still in beta which means we will have to install the beta version of RClone. If you have a previous version installed, make sure to remove it first.

Warning: Running install scripts from the web is dangerous and you should carefully audit it before running it.

# Download the install script
curl https://rclone.org/install.sh > install-rclone.sh

# Audit the install script to make sure it is safe.
# Copy and paste the script into an AI you trust and ask it if is safe
# if you do not understand it.
cat ./install-rclone.sh

# Then run the install script after auditing it to make sure it is safe
sudo -v && sudo bash install-rclone.sh beta

Configure Config Encryption

Once you have installed RClone, it is now time to set up configuration encryption to ensure that your Proton credentials are stored safely.

Here is the procedure in RClone’s documentation.

Encrypt the RClone Config File

# First run the following command:
rclone config

Current remotes:

e) Edit existing remote
n) New remote
d) Delete remote
s) Set configuration password
q) Quit config
e/n/d/s/q>

# Enter "s"
e/n/d/s/q> s

After selecting option “s” for “Set configuration password”, select option “a” for “Add Password”.

Your configuration is not encrypted.
If you add a password, you will protect your login information to cloud services.
a) Add Password
q) Quit to main menu
a/q> a

You will then be prompted for a password. Enter your password twice the select “q” twice to quit.

Enter NEW configuration password:
password:
Confirm NEW password:
password:
Password set
Your configuration is encrypted.
c) Change Password
u) Unencrypt configuration
q) Quit to main menu
c/u/q>q

⚠️ Important: Make sure you save this password in a secure place as we will need it for automatic mounting later.

Configure the Proton Remote

Now that RClone has been installed, we need to connect to Proton Drive by adding a RClone remote and running a command to obtain long term session keys.

Here is the procedure in RClone’s documentation.

Step 1: Open the Configuration Menu

First enter the configuration menu by entering your configuration password.

rclone config
Enter configuration password:
password:
...
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q>

Step 2: Add a New Remote

Once you’ve entered your password, select option “n” for “New remote”, give it a relevant name such as “proton”.

...
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> proton

Step 3: Select the Storage Backend

Once you’ve select the name of the remote, RClone will prompt you for the storage backend. Select “protondrive” or the number associated with Proton Drive.

Type of storage to configure.
Choose a number from below, or type in your own value
[snip]
XX / Proton Drive
\ "protondrive"
[snip]
Storage> protondrive

If you do not find Proton Drive it means that you installed the wrong version.

Step 4: Enter Your Proton Credentials

Once you’ve selected Proton Drive as the storage type, you will be prompted for your Proton credentials. Enter your email, your password and 2FA token.

If you are using 2FA you will have to perform all the commands before your 2FA token expires, so complete the form up to the point until you have to enter a 2FA token and then wait until you get a fresh token before continuing.

User name
user> you@protonmail.com
Password.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank
y/g/n> y
Enter the password:
password:
Confirm the password:
password:

Enter your 2FA token (if required):

Option 2fa.
2FA code (if the account requires one)
Enter a value. Press Enter to leave empty.
2fa> 123456

⚠️ 2FA Users: You need to enter all commands before your 2FA token expires. If your token expires, restart the process.

Then quickly select “y” and “q” to confirm your selection (If you used 2FA you only have a few seconds to do this).

Remote config
Configuration complete.
Options:
- type: protondrive
- user: you@protonmail.com
- pass: *** ENCRYPTED ***
Keep this "remote" remote?
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y

In order to obtain your session tokens you need to quickly run the ls command and enter your password before your 2FA token expires.

rclone ls proton:
Enter configuration password:
password:
32323 file_name.txt
...
# Your files will be displayed if successful

Configuring the automatic mount

Now that rclone and the proton remote has been configured, we are ready to setup the automatic mount for Proton Drive.

Step 1: Install Python Keyring

The first step is to add your password your keyring. There are multiple implementations of OS Keyrings out there but luckily, python has library called python-keyring which supports most keyring implementations.

# Install keyring
pip install --user keyring

Step 2: Store Your RClone Password in the Keyring

Once you have python-keyring installed you can now save your password in your OS keyring for later retrieval. Run the following command and enter your RClone configuration password when prompted.

keyring set rclone proton
Password for 'proton' in 'rclone':

Step 3: Download the Management Script

Download the management script I wrote to manage the mounting and un-mouting of Proton.

curl https://gist.githubusercontent.com/oleduc/b3473b34801f9618b77e579392a12d79/raw/42707a0414c7aa16d2cb24e846d3ed5c14d6c1d9/rclone-mount-proton.sh > rclone-mount-proton.sh
sudo mv rclone-mount-proton.sh /usr/local/bin/rclone-mount-proton.sh

Step 4: Modify the Script

Audit and modify the script to match your own configuration

sudo nano /usr/local/bin/rclone-mount-proton.sh

#!/bin/bash

# Define remote name and mount point
REMOTENAME="proton"
MOUNTPOINT="$HOME/ProtonDrive"
...

Give the script execution permissions:

sudo chmod +x /usr/local/bin/rclone-mount-proton.sh

Setting Up a systemd Service

Now we will create a user service to automatically run our script at the appropriate times.

mkdir -p ~/.config/systemd/user
sudo nano ~/.config/systemd/user/rclone-proton-mount.service

Replace your-username with your actual username.

[Unit]
Description=Mount Proton Drive using Rclone
After=default.target
Requires=default.target

[Service]
Type=simple
ExecStart=/usr/local/bin/rclone-mount-proton.sh mount
ExecStop=/usr/local/bin/rclone-mount-proton.sh unmount
ExecReload=/usr/local/bin/rclone-mount-proton.sh unmount && /usr/local/bin/rclone-mount-proton.sh mount
Restart=always
RestartSec=10
Environment=HOME=%h
KillMode=process

[Install]
WantedBy=default.target

Install and enable the service:

systemctl --user daemon-reload
systemctl --user enable rclone-proton-mount.service
systemctl --user start rclone-proton-mount.service

# Check the service log to insure it ran well
journalctl --user -u rclone-proton-mount.service -f

And voilà! Now restart your machine and make sure that you’re prompted for your keyring password and that your proton drive files are accessible from your mount point.

--

--

Leduccc
Leduccc

Written by Leduccc

I'm writing simple and accessible tutorials for all the aspiring computer scientists out there!

No responses yet