{"id":20703189,"url":"https://github.com/sfttech/sftbackup","last_synced_at":"2025-06-16T02:08:21.947Z","repository":{"id":142753832,"uuid":"222550323","full_name":"SFTtech/sftbackup","owner":"SFTtech","description":"simple periodic backup tool based on borgbackup and snapper","archived":false,"fork":false,"pushed_at":"2019-12-02T16:26:33.000Z","size":23,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-23T00:17:54.553Z","etag":null,"topics":["borg","borg-backup","python","snapper"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SFTtech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"copying.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"liberapay":"SFTtech"}},"created_at":"2019-11-18T21:42:47.000Z","updated_at":"2024-02-15T20:35:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"a1383697-46fb-47f0-974c-5a580b9d0535","html_url":"https://github.com/SFTtech/sftbackup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SFTtech/sftbackup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SFTtech%2Fsftbackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SFTtech%2Fsftbackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SFTtech%2Fsftbackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SFTtech%2Fsftbackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SFTtech","download_url":"https://codeload.github.com/SFTtech/sftbackup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SFTtech%2Fsftbackup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260083863,"owners_count":22956409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["borg","borg-backup","python","snapper"],"created_at":"2024-11-17T01:06:42.293Z","updated_at":"2025-06-16T02:08:21.923Z","avatar_url":"https://github.com/SFTtech.png","language":"Python","funding_links":["https://liberapay.com/SFTtech"],"categories":[],"sub_categories":[],"readme":"sftbackup\n=========\n\nSimple wrapper for [borg backup](https://github.com/borgbackup/borg) and [snapper](https://github.com/openSUSE/snapper)\n\n* [Config file](etc/sftbackup.cfg) example.\n\n\nRemote backup setup\n-------------------\n\nYou can store the backup over SSH on a remote server.\n\nThis even works for multiple clients to one server as borg can jail clients by ssh forced commands.\n\n\n### Client setup\n\nBackup targets:\n* Remote server via SSH (you have a borg remote url)\n* Local storage (secondary harddrive, a `nfs`/`samba` mount, ...)\n\n\n#### Remote backup client preparation\n\nIf you do your backup remotely via SSH, you need a SSH key first.\n\n* Generate ssh-key for user `root`\n  * Of course you may reuse an existing ssh key, but root has to be configured to use it.\n\n```\nHOME=/root sudo ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519_backup\n```\n\n* Provide your ssh public key in `/root/.ssh/id_ed25519_backup.pub` to the server operator\n* Configure SSH to use the right *user* and *ssh key* in `/root/.ssh/config`:\n\n```\n# example config if your borg backup remote url is \"borg@borgbackup.somewhere.net:reponame\"\nHost borgbackup.somewhere.net\n    User borg\n    IdentityFile ~/.ssh/id_ed25519_backup\n```\n\n#### Client configuration\n\n* Configure `sftbackup` in `/etc/sftbackup.cfg`\n* Set `password = ...` to encrypt the backup\n  * To generate a password, you can use `pwgen 30 1`\n  * **Note down the password** somewhere (to be able to restore the backup!)\n* Use `repo = ...` to specify where to store the backup\n  * Remote backup via SSH: `repo = borg@borgbackup.somewhere.net:reponame`\n  * Local storage, e.g. external HDD: `repo = /mnt/backupdrive`\n* Adjust other things like paths, excludepaths, ...\n\n\n#### Repo creation\n\n* Create the repo: `sudo sftbackup init`\n* This will initialize the borg repo in `repokey` mode.\n\n\n#### Test backup\n\n* Test the creation of the first backup by running `sudo sftbackup backup`\n\n\n#### Automated runs\n\nThis is only suitable for devices that are permanently running (e.g. servers)\n\n* Install the `sftbackup.timer` and `sftbackup.service` systemd units\n* Enable and start the `sftbackup.timer`\n\nEnjoy your backups!\n\n\n### Server setup\n\nRepo storage:\n* Create a `borg` user on your host: `sudo useradd -m borg`\n* Create the storage directory: `sudo mkdir /home/borg/repos`.\n* Create the `authorized_keys` file in `/home/borg/.ssh/authorized_keys`\n  * Ensure the `.ssh` and `authorized_keys` file belong to user `borg`\n\nClient access:\n* Create a directory `/home/borg/repos/clientname` (owned by user `borg`)\n* Grant access in `authorized_keys`:\n\n```\ncommand=\"cd /home/borg/repos/clientname; borg serve --restrict-to-repository /home/borg/repos/clientname/reponame --storage-quota 1.5T\",restrict ssh-ed25519 client's_ssh_public_key_... root@clientname\n```\n\n* Add `--append-only` to disallow this client to remove data in its repos (very handy so a server can't delete its own backup when hacked).\n* See `man borg-serve` for further information on how to restrict client access\n\n\nRestore\n-------\n\n* Retrieve and store file(s) from repo\n  * use [`borg extract`](https://borgbackup.readthedocs.io/en/stable/usage/extract.html)\n* Mount repo as [FUSE](https://en.wikipedia.org/wiki/Filesystem_in_Userspace)\n  * use [`borg mount`](https://borgbackup.readthedocs.io/en/stable/usage/mount.html)\n\n\nContributing\n------------\n\nAs you might have guessed, you can report issues and submit patches through pull requests easily.\n\n\nLicense\n-------\n\n**GNU GPLv3** or later; see [copying.md](copying.md) and [legal/GPLv3](/legal/GPLv3).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsfttech%2Fsftbackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsfttech%2Fsftbackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsfttech%2Fsftbackup/lists"}