Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

mc

The MinIO client: work with any S3-compatible object storage (MinIO, AWS S3, Azure via gateway, Ceph) — buckets, copies, mirrors, policies.

Niveau
DevSecOps-service
Groep
Databases en messaging
Root nodig
Nee
Pakket
mcli
Ook
minio, mcli

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

MinIO is a fast S3-compatible object store you can run yourself (on VMs or Kubernetes) — useful for backups, Loki/Tempo storage, Terraform state in labs, and artifacts. mc works with aliases (a URL + keys) and has Unix-like commands: ls, cp, mirror, rm, cat, plus admin commands for users and policies. On some systems the binary is called mcli to avoid a clash with Midnight Commander.

Zo schrijf je het

mc alias set NAME URL ACCESS_KEY SECRET_KEY
mc COMMAND ALIAS/BUCKET/PATH

Belangrijkste delen

Commands

alias set|list|remove
Save server connections.
mb / rb ALIAS/BUCKET
Make / remove a bucket.
ls / tree / du
List / tree / size.
cp / mv / rm
Copy / move / remove objects.
mirror SRC DST
Sync folders or buckets (backups).
cat / head
Read an object.
share download PATH
Time-limited link.
version enable ALIAS/BUCKET
Turn on versioning.
ilm rule add
Lifecycle (expire old objects).
encrypt set sse-s3 ALIAS/BUCKET
Default encryption.
admin user|policy|info
Users, policies, server info.
anonymous set none ALIAS/BUCKET
No public access.

Opties 6

Meest gebruikt

Flags

--recursive, -r
Whole folder.
--remove
Delete extra files in the target (mirror).
--watch
Keep mirroring changes.
--older-than 30d
Filter by age (rm, ls).
--expire 1h
Link lifetime (share).
--json
JSON output.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Run MinIO for a lab

    podman run -d --name minio -p 127.0.0.1:9000:9000 -p 127.0.0.1:9001:9001 -e MINIO_ROOT_USER=admin -e MINIO_ROOT_PASSWORD=labonly-2026 quay.io/minio/minio server /data --console-address :9001
  2. 2Set an alias and make a bucket

    mc alias set lab http://127.0.0.1:9000 admin labonly-2026
    mc mb lab/backups
    mc ls lab
  3. 3Copy and list files

    mc cp backup-2026-10-27.tar.gz.age lab/backups/web1/
    mc ls --recursive lab/backups/
  4. 4Mirror a folder every night (backup)

    mc mirror --overwrite /srv/backups lab/backups/web1
  5. 5Turn on versioning and default encryption

    mc version enable lab/backups
    mc encrypt set sse-s3 lab/backups
  6. 6Delete backups older than 30 days with a lifecycle rule

    mc ilm rule add --expire-days 30 lab/backups
  7. 7Make sure nothing is public

    mc anonymous get lab/backups
    mc anonymous set none lab/backups
  8. 8A user that can only write backups

    cat backup-writer.json
    {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:PutObject","s3:ListBucket"],"Resource":["arn:aws:s3:::backups","arn:aws:s3:::backups/*"]}]}
    mc admin policy create lab backup-writer backup-writer.json
    mc admin user add lab web1-backup 'Ch4nge-me-2026-long'
    mc admin policy attach lab backup-writer --user web1-backup
  9. 9Share a file for one hour

    mc share download --expire 1h lab/backups/web1/backup-2026-10-27.tar.gz.age
  10. 10Use mc with AWS S3

    mc alias set s3 https://s3.eu-central-1.amazonaws.com AKIAEXAMPLEONLY0000 exampleSecretOnly
    mc ls s3/s0sta-lab-backups-2026

Let op

  • Aliases store keys in ~/.mc/config.json — keep it private.
  • mirror --remove deletes objects in the target that are not in the source.
  • Backup users should not have delete rights (protects against ransomware); use versioning or object lock.

Bestanden

~/.mc/config.json
Aliases and keys.

Tips om te onthouden

  • Use object lock (WORM) for backups that even an admin cannot delete for N days.

Exitcodes

0Success.
1Error.

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man mc