← 返回
未分类 中文

openclaw-backup-restore

Backup or restore your entire OpenClaw setup including config, agents, skills, credentials, and workspace as a timestamped portable .tar.gz archive.
备份或恢复 OpenClaw 环境,包括配置、代理、技能、凭证和工作区,生成带时间戳的 .tar.gz 便携归档。
brunovu20
未分类 clawhub v1.0.2 2 版本 100000 Key: 无需
★ 0
Stars
📥 319
下载
💾 0
安装
2
版本
#latest

概述

OpenClaw Backup & Restore Skill

Snapshot and migrate your complete OpenClaw setup — config, agents, flows, skills, credentials,

memory, and workspace — as a single portable archive.

What this skill does

  • Backup: Archives the entire ~/.openclaw/ directory into a timestamped .tar.gz

(or .tar.gz.gpg if encrypted) — no files excluded.

  • Restore: Extracts an archive back into ~/.openclaw/, preserving directory structure and

permissions, so OpenClaw works immediately after extraction.

  • List: Shows available backup archives in the configured output directory.
  • Verify: Validates a backup archive's integrity before restore.

Use this skill when the user says:

  • "backup my openclaw setup"
  • "migrate openclaw to my new machine"
  • "snapshot my openclaw config"
  • "restore openclaw from backup"
  • "what backups do I have?"

What is backed up

The entire ~/.openclaw directory — every file and subdirectory — is included in the archive.

No exclusions. The restored machine gets an exact copy of the original, and OpenClaw works

immediately without any missing configuration, credentials, skills, or state.

See references/paths.md for details on sensitive paths and restore-time permissions.

Workflow

Backup

  1. Resolve the OpenClaw home directory (OPENCLAW_HOME, defaults to ~/.openclaw).
  2. Resolve the output directory (BACKUP_DIR, defaults to ~/openclaw-backups).
  3. Archive the full ~/.openclaw directory into a timestamped .tar.gz.
  4. Optionally encrypt with GPG: --encrypt flag or BACKUP_GPG_RECIPIENT env var.
  5. Print the archive path and size.

Restore

  1. Validate the archive (non-empty, valid gzip, no path traversal).
  2. Warn if ~/.openclaw already exists and prompt for confirmation (or use --force).
  3. Optionally decrypt if .gpg extension detected.
  4. Extract to ~/.openclaw/ with --strip-components=0.
  5. Fix permissions on sensitive files (credentials/, secrets/, identity/).
  6. Print a summary of restored paths.

List

Print all .tar.gz and .tar.gz.gpg files in BACKUP_DIR with size and date.

Verify

Run gzip -t on the archive and list its top-level contents without extracting.

Scripts

ScriptPurpose
------
scripts/backup.shCreate a backup archive
scripts/restore.shRestore from a backup archive

Usage examples

# Create a backup in ~/openclaw-backups/
bash scripts/backup.sh

# Backup to a custom directory
bash scripts/backup.sh --output /Volumes/USB/backups

# Backup with GPG encryption
bash scripts/backup.sh --encrypt you@example.com

# List available backups
bash scripts/backup.sh --list

# Verify a backup without restoring
bash scripts/restore.sh --verify openclaw-backup-2026-05-24_120000.tar.gz

# Restore (will prompt before overwriting)
bash scripts/restore.sh openclaw-backup-2026-05-24_120000.tar.gz

# Restore without confirmation prompt
bash scripts/restore.sh --force openclaw-backup-2026-05-24_120000.tar.gz

# Restore to a custom openclaw home
bash scripts/restore.sh --home /opt/openclaw openclaw-backup-2026-05-24_120000.tar.gz

Migration workflow (old machine → new machine)

  1. On the old machine: run bash scripts/backup.sh — copy the .tar.gz to the new machine.
  2. On the new machine: install OpenClaw binary, then run bash scripts/restore.sh .
  3. OpenClaw will start with your full config, agents, skills, credentials, and workspace intact.

Security notes

  • credentials/ and secrets/ contain sensitive API keys. Keep backups in a secure location.
  • Use --encrypt with a GPG key for backups stored in cloud storage or on shared drives.
  • The restore script sets chmod 700 on sensitive directories automatically.

Guardrails

  • Never extract archives with path components that escape ~/.openclaw/ (path traversal check).
  • Always show the archive size and file count after backup so the user can sanity-check completeness.
  • If OpenClaw is running during backup, warn the user — SQLite databases may be in a dirty state.
  • Do not backup identity/device-auth.json without informing the user it contains auth tokens.

版本历史

共 2 个版本

  • v1.0.2 当前
    2026-05-29 21:19 安全 安全
  • v1.0.0
    2026-05-26 23:40 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

google trending

brunovu20
获取并展示过去24小时内任意国家的Google热门搜索。当用户询问Google热门话题或热门搜索时使用。
★ 0 📥 265

ai-trending-news

brunovu20
获取、排名并汇总十大热门AI新闻,来源涵盖可信赖的编辑、官方、研究及社区资源,供用户提问时使用。
★ 0 📥 283

github-trending

brunovu20
获取今日/本周/本月GitHub 热门仓库,并汇总前 15 名的星数、语言和描述。
★ 0 📥 241