bijavix blog

Encrypted Cloud Mountpoint with rclone

bijavix <[email protected]>

Create an encrypted Google Drive mount using rclone, allowing fast and secure system storage at the cloud. Perfect if your organization has unlimited storage. OAuth client authentication and encrypted remote with suitable VFS cache modes for secure and efficient cloud-storage access.

1. Preparation (optional)

You can speed up interactions with Google Drive by supplying your own client ID or by using a service account.

1.1. Create an OAuth client ID

Follow these steps in the Google Cloud console:

  1. Go to Google Cloud console.

  2. APIs and servicesCreate new project → name it Drive.

  3. Enable APIs and services → enable Google Drive API.

  4. CredentialsConfigure consent screen (only once per Google account).

  5. Back in CredentialsCreate credentialsOAuth client ID.

    • Application type: Desktop app

    • Name: rsync-desktop

    • Click Create and download or copy the Client ID and Client secret.

  6. In OAuth consent screen click Publish app.

Configuration will be stored at ~/.config/rclone/ unless RCLONE_CONFIG_DIR is set.

2. Install rclone

apt install rclone

3. Configure the Google Drive remote

rclone config

Interactive prompts:

n                         # New remote
name> myCloud             # Remote name
Storage> drive            # Select Google Drive
client_id> 1234....apps.googleusercontent.com
client_secret> 1234...
scope> 1                  # Full access
service_account_file>     # Press Enter to skip
auto config> y            # Opens your browser for OAuth

Log in with the Google account you used above, then return to the terminal to finish.

3.1. Test access

rclone ls myCloud:

If a file listing appears, authentication is working.

4. Configure the encrypted remote

rclone config

Interactive options:

n                              # New remote
name> myCloudCrypt             # Encrypted remote name
Storage> crypt                 # Select crypt
remote> myCloud:/crypt         # Remote created previosly
filename_encryption> 1         # Encrypt file names
directory_name_encryption> 1   # Encrypt directory names

5. Mount the encrypted storage

mkdir -p ~/myCloud
rclone mount myCloudCrypt: ~/myCloud --vfs-cache-mode minimal --buffer-size 64M --transfers 6

5.1. VFS cache modes (--vfs-cache-mode)

  • off - Files are streamed directly to the remote.

  • minimal - Metadata and directory entries are cached locally.

  • writes - Write operations are cached locally before upload, enabling partial and random-access writes.

  • full - Entire files are cached locally for both reads and writes before upload.