AutomationFlowsGeneral › Automated Credentials Backup to Google Drive via SSH and Docker

Automated Credentials Backup to Google Drive via SSH and Docker

ByAlexandru Florea @elitiv on n8n.io

This workflow automates the backup of decrypted n8n credentials from a self-hosted Docker instance to Google Drive. It allows you to export credentials on n8n versions 2.x.x (where old CLI commands may not work) without accessing the server terminal manually.

Event trigger★★★★☆ complexity9 nodesSshRead Write FileGoogle Drive
General Trigger: Event Nodes: 9 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #11842 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ebaa3433-1ac7-48c1-85b9-ba540704e1b5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -352
      ],
      "parameters": {
        "color": 4,
        "width": 655,
        "height": 356,
        "content": "## Export All Credentials From n8n Docker Container\n* Setup your variables first\n* Connect to the host using SSH or your details\n* Executing Docker command to backup credentials\n* Read the file from the host"
      },
      "typeVersion": 1
    },
    {
      "id": "5e66dcb1-d8a1-4b7e-a5fa-b88a2a2c0d7c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -352
      ],
      "parameters": {
        "color": 6,
        "width": 311,
        "height": 356,
        "content": "## Google Drive Folder\n* Setup your Google Drive credentials\n* Upload credentials from n8n to Google Drive selected folder"
      },
      "typeVersion": 1
    },
    {
      "id": "692a1d86-c53f-4b05-b29f-dfeed1ea1b50",
      "name": "Execute a command",
      "type": "n8n-nodes-base.ssh",
      "position": [
        16,
        -192
      ],
      "parameters": {
        "command": "=docker exec -u node {{ $json['Docker Container name (n8n)'] }} mkdir -p /home/node/.n8n-files && docker exec -u node {{ $json['Docker Container name (n8n)'] }} n8n export:credentials --all --decrypted --output={{ $json['Docker - n8n credentials files'] }}"
      },
      "typeVersion": 1
    },
    {
      "id": "fb1ec45f-6ec9-4857-825d-9a10508735f0",
      "name": "Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        -208,
        -192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fcc959dd-0993-4b04-9149-586f69670bce",
              "name": "Backup Folder",
              "type": "string",
              "value": "n8n backups"
            },
            {
              "id": "8622a4f3-3322-4906-bd65-5c3f26596835",
              "name": "Docker Container name",
              "type": "string",
              "value": "YOUR n8n DOCKER CONTAINER NAME"
            },
            {
              "id": "382cc02e-d5a0-48be-9343-7a39ca54c7ab",
              "name": "Docker - n8n credentials files",
              "type": "string",
              "value": "/home/node/.n8n-files/credentials.json"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c591352b-20f5-46a6-ad6e-f614c200d802",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        -464
      ],
      "parameters": {
        "width": 768,
        "height": 672,
        "content": "## Backup Credentials to Drive for **n8n 2.x.x**\n\nThis solution will work with the n8n version 2.x.x and 1.x.x.\nIt is not used CLI commands what are not working in NEW n8n version.\n\n\n**NOTE** This solution was configured to work with Docker\n\nConfigure required variables from \"Variables\" tool in the following way by default:\n\n### Standard Configuration\n```\n// \"Backup Folder\" is folder where do you want to save credentials on your Drive\n Backup Folder -> Your folder from Google Drive\n   \n// \"Docker Container name\" is your n8n docker container name or ID\n Docker Container name -> YOUR n8n DOCKER CONTAINER NAME or ID\n   \n// \"Docker - n8n credentials files\" is a link to internal docker container JSON file created in a \"Execute a command\" tool\n Docker - n8n credentials files -> /home/node/.n8n-files/credentials.json OR Your custom link if you change docker command\n   \n// Will be executed this docker commands in the \"Execute...\" tool\ndocker exec -u node [Docker Container name] mkdir -p /home/node/.n8n-files && docker exec -u node [Docker Container name] n8n export:credentials --all --decrypted --output=[Docker - n8n credentials files]\n```\n\n### You are welcome to do your custom configuration based on your needs\n\n**If you need some help or make some changes** I am more then welcome to help you.\nContact me at alex@elitiv.com "
      },
      "typeVersion": 1
    },
    {
      "id": "972b8628-c987-4256-aa15-6d5ac6f7d224",
      "name": "On clicking 'execute'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -432,
        -304
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "54925466-eafa-41f0-b049-6f224bc987de",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -432,
        -112
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "eb8bc7aa-8970-4df7-ae1a-78bab54c2ed5",
      "name": "Read File",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        240,
        -192
      ],
      "parameters": {
        "options": {
          "dataPropertyName": "data"
        },
        "fileSelector": "={{ $('Variables').item.json['Docker - n8n credentials files'] }}"
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "24c469f0-76b9-48a6-a5c6-34ccb4017993",
      "name": "Google Drive Upload File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        608,
        -192
      ],
      "parameters": {
        "name": "=n8n_credentials {{ $now.format('cccc t dd-MM-yyyy') }}.json",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "n8n backups",
          "cachedResultUrl": "https://drive.google.com/drive/folders/YOUR_FOLDER",
          "cachedResultName": "n8n backups"
        },
        "inputDataFieldName": "=data"
      },
      "typeVersion": 3
    }
  ],
  "connections": {
    "Read File": {
      "main": [
        [
          {
            "node": "Google Drive Upload File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Variables": {
      "main": [
        [
          {
            "node": "Execute a command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute a command": {
      "main": [
        [
          {
            "node": "Read File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow automates the backup of decrypted n8n credentials from a self-hosted Docker instance to Google Drive. It allows you to export credentials on n8n versions 2.x.x (where old CLI commands may not work) without accessing the server terminal manually.

Source: https://n8n.io/workflows/11842/ — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Back up n8n workflows to Google Drive automatically This workflow provides a robust solution for backing up your n8n workflows to Google Drive. It is designed to handle backups for multiple n8n instan

Execute Workflow Trigger, n8n, Google Drive
General

Batch watermark every image in a Google Drive folder and save the results to a separate destination folder — fully automated, no code required, and no external tools or APIs needed.

Google Drive, Edit Image
General

This workflow is perfect for technical writers, content creators, marketers, and developers who write in Markdown but need to collaborate or publish using Google Docs format. Ideal for teams that want

Google Drive
General

This workflow automates the process of merging multiple files from a designated folder into a single, well-organized Excel workbook. Each input file is converted into its own sheet within the output f

Read Write File