Rested
All guides
9 min readWritten and maintained by Rested

Minimum S3 permissions for restic backups and pruning

Grant restic the S3 permissions it needs to list, read, write, restore, forget, and prune without giving the backup host control of every bucket.

Start with the operations restic actually performs

Restic stores configuration, keys, snapshots, indexes, locks, and data packs as objects. A normal backup client must list the repository, read existing metadata and data, write new objects, and delete locks or obsolete objects. Retention and pruning make delete access unavoidable on that client. On Amazon S3, the client commonly also needs s3:GetBucketLocation to resolve the bucket correctly.

Read-only credentials can handle many recovery tasks, including listing and restoring existing snapshots, when the command supports --no-lock. Use that flag only when you know no writer or maintenance job is changing the repository. Read-only access is insufficient for routine backups, maintenance, or lock cleanup, so a separate recovery key does not replace the active backup credential.

  • List: discover repository objects beneath the configured prefix.
  • Read: open repository configuration, indexes, snapshots, packs, and locks.
  • Write: initialize the repository and upload new metadata, packs, and locks.
  • Delete: remove locks and reclaim data during forget and prune.

AWS separates bucket and object permissions

In Amazon S3 IAM, ListObjectsV2 maps to s3:ListBucket and targets the bucket ARN. GetObject, PutObject, and DeleteObject target object ARNs. Mixing those resource types is a common reason a policy looks correct but returns AccessDenied.

A least-privilege policy therefore needs a bucket-level statement for location and prefix-constrained listing, plus object-level read, write, and delete access for the repository prefix. Use the current AWS and restic examples to produce the actual JSON; do not copy a policy from an unrelated bucket layout.

Prefix scoping needs two controls

Restricting object actions to bucket/prefix/* prevents the credential from reading or changing objects elsewhere in the bucket. Listing is a bucket-level action, so AWS uses an s3:prefix condition to limit which keys a ListObjects request may return. Depending on the client’s request shape, the allowed values may need both the prefix itself and prefix/*.

Do not paste an AWS policy unchanged into every S3-compatible service. Some providers implement only part of IAM’s condition language, some scope credentials through their own UI, and some need a broader list capability for SDK compatibility. Start with the provider’s documented mechanism, then test the exact endpoint and prefix with the same client used for backups.

How the provider permission models translate

The names differ, but the required object operations do not. Use a dedicated machine credential and keep account administration out of its scope.

  • Cloudflare R2: create an Object Read & Write S3 API token and apply it only to the backup bucket. Use the Access Key ID and Secret Access Key shown when the token is created.
  • Backblaze B2: a restricted application key may need listAllBucketNames for S3 SDK compatibility, plus listFiles, readFiles, writeFiles, and deleteFiles for the repository. Backblaze documents the exact S3 calls behind those capabilities.
  • Wasabi: attach a bucket- or folder-restricted IAM policy to a dedicated sub-user, then create that user’s access key. Console access and broad S3 administration are unnecessary for the backup process.
  • MinIO: attach a policy to a dedicated user and create an access key that inherits, or further narrows, that policy. MinIO denies operations that are not explicitly allowed.

Permissions you usually should not grant

An existing-bucket restic setup does not need to create or delete buckets, change bucket policies, manage users, configure public access, edit lifecycle rules, or administer replication. It also does not need wildcard access to every bucket in the account.

Extra permissions can appear necessary when a provider’s web console performs account-level discovery before showing a bucket. The backup agent does not need to browse that console. Separate console convenience from the S3 API calls the backup process actually makes, except where the provider explicitly requires a compatibility capability such as Backblaze’s listAllBucketNames.

Prove the credential before trusting it

A policy review catches obvious overreach; a disposable-object test catches endpoint, region, scope, and compatibility mistakes. Verify the credential against its intended scope without touching an existing repository object.

Rested validates destination setup and reports actionable configuration errors before a backup is attempted. The implementation stays inside the product; operators only need the result and a useful error.

Reduce the damage a stolen key can do

Bucket and prefix scope limits lateral damage, but the active backup credential can still delete its own repository. Store it in a root-only secret store, keep it out of shell history and logs, rotate it, and alert on unusual object deletion. Disable the old key only after a backup, prune, and restore test succeeds with the replacement.

For stronger deletion resistance, send another copy to an immutable or append-only target and keep its maintenance credential away from the protected host. Applying object lock directly to an active restic repository needs careful testing because restic maintenance rewrites and deletes objects. An isolated protected copy is easier to reason about during an incident.

Technical basis

First-party references

Technical claims and limitations in this guide were checked against these primary sources. Confirm version-specific behavior when designing a production recovery process.

Related from Rested

Common questions

Frequently asked questions

Does restic need s3:DeleteObject?

Yes for normal repository maintenance. Restic removes locks and forget with prune deletes obsolete repository objects. A credential without delete access may back up some data but cannot support the complete lifecycle.

Can restic use a read-only S3 key?

A read-only key can list and restore existing snapshots if it covers the repository prefix and the supported command is run with --no-lock. Avoid concurrent writes while bypassing locks. The key cannot initialize a repository, create backups, manage locks, forget snapshots, or prune data.

Does restic need access to the whole S3 bucket?

No. Object operations can usually be restricted to the repository prefix, while bucket listing is constrained to that prefix using the provider’s supported mechanism. Verify prefix conditions because S3-compatible providers differ in IAM support.

Why does listing fail when object permissions look correct?

On AWS, object permissions target bucket/prefix/*, while s3:ListBucket targets the bucket ARN and is commonly narrowed with an s3:prefix condition. A policy that grants only object-resource actions cannot authorize ListObjectsV2.

Should the backup key be allowed to create buckets?

Usually no. Create the bucket through an administrative account, then give the backup credential only the operations required inside its repository prefix. This also prevents a configuration error from creating storage in the wrong region.