Automated Decrypted Credentials Backup to Google Drive via SSH and Docker - n8n Workflow

Securely back up your decrypted n8n credentials from a Docker container to Google Drive using this essential n8n workflow. Perfect for DevOps and self-hosted n8n environments.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

• DevOps professionals managing self-hosted n8n instances on Docker.
• System administrators needing regular, robust backups of core application data.
• n8n power users who want resilient n8n templates for disaster recovery.
• Teams requiring automated compliance logging for integration credentials.

Overview

This crucial n8n workflow addresses the vulnerability of losing connection details in self-hosted environments. By operating directly on your infrastructure, this solution provides highly reliable credentials backup. The n8n automation leverages an SSH connection to remotely execute the native n8n CLI command (n8n export:credentials) inside the designated Docker container. This process generates a comprehensive, decrypted JSON file containing all your integrations. The subsequent steps in the n8n workflow ensure that this critical data is securely moved from the local host system and uploaded to a specific folder in Google Drive, making this n8n node combination perfect for reliable scheduled maintenance. Utilize this n8n template to ensure business continuity and quick recovery after any instance failure.

How it Works

The entire process is designed for scheduled execution, initiated by an n8n trigger, providing hands-off automation.


  1. Trigger and Configuration: The n8n workflow is started by the 'Schedule Trigger' (or manually). The subsequent 'Variables' n8n node defines essential parameters, including the Docker container name, the Google Drive backup folder, and the internal file path where the temporary credentials file will be created.

  2. Remote Execution (SSH): The n8n node 'Execute a command' connects via SSH to the host machine. It runs a complex docker exec command to interact directly with the running n8n container. This command executes the n8n export:credentials --all --decrypted CLI function, saving the sensitive JSON data inside the container.

  3. File Retrieval: The 'Read File' n8n node accesses the temporary credentials file created by the previous step, preparing the file data for upload.

  4. Secure Upload: Finally, the 'Google Drive Upload File' n8n node receives the credentials data. It automatically generates a file name incorporating the current date (n8n_credentials [Date].json) and uploads the backup securely to the designated folder ('n8n backups') in Google Drive. This complete n8n workflow ensures your credentials are safe and easily retrievable.

Installation Guide

To deploy this essential n8n template, follow these steps:


  1. Import: Import the provided JSON code directly into your n8n instance.

  2. SSH Credentials: Set up SSH credentials for the user that has permissions to run docker exec commands on the host system where your n8n container resides.

  3. Google Drive Credentials: Configure Google Drive credentials to allow file creation and upload in your target folder.

  4. Configure Variables: Navigate to the 'Variables' n8n node and update the following settings:

Docker Container name: Replace the placeholder with the exact name or ID of your running n8n Docker container.
Backup Folder: Confirm or change the name of the destination folder in Google Drive (default is 'n8n backups').

  1. Schedule: Set the desired interval (e.g., daily, weekly) within the 'Schedule Trigger' n8n trigger to automate the backup.

Ensure that the user configured in your SSH credentials has the necessary privileges to execute docker commands on the host machine for the n8n workflow to run successfully.

Node Details

Schedule Trigger / On clicking 'execute': These n8n trigger nodes initiate the n8n workflow on a schedule or manually, depending on your testing and deployment needs.
Variables (Set n8n node): Defines runtime parameters essential for the n8n automation, including configuration paths and container identification.
Execute a command (SSH n8n node): The core operational n8n node. It uses SSH to execute the command docker exec -u node [Container Name] n8n export:credentials --all --decrypted --output=/path/credentials.json, ensuring the creation of a full, decrypted credentials backup inside the n8n container.
Read File (n8n node): Retrieves the binary data of the newly created credentials.json file from the host system, preparing the payload for the final action.


  • Google Drive Upload File (n8n node): Uploads the file data using dynamic naming (e.g., n8n_credentials [Date].json) to the specified Google Drive folder, completing the secure n8n workflow backup.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

I am a Technical Operations Manager who bridges the gap between complex code and business revenue. With over 15 years of experience, I don't just build websites; I build digital ecosystems that sell. I specialize in taking ownership of the entire technical and marketing stack for SMEs—handling everything from Server Configuration and Python automation to Google Ads and SEO strategy. Core Value: I help business owners stop worrying about their technology so they can focus on their customers.

Featured*