1
0
mirror of https://github.com/minio/docs.git synced 2025-05-28 00:41:14 +03:00
docs/source/reference/minio-mc.rst

18 KiB

MinIO Client

minio

Table of Contents

mc

The MinIO Client mc command line tool provides a modern alternative to UNIX commands like ls, cat, cp, mirror, and diff with support for both filesystems and Amazon S3-compatible cloud storage services.

mc has the following syntax:

mc [GLOBALFLAGS] COMMAND --help

See minio-mc-commands for a list of supported commands.

AGPLv3

mc is AGPLv3 <mc/blob/master/LICENSE> licensed Free and Open Source (FOSS) software.

Applications integrating mc may trigger AGPLv3 compliance requirements. MinIO Commercial Licensing is the best option for applications which trigger AGPLv3 obligations where open-sourcing the application is not an option.

Quickstart

1) Install mc

Install the mc command line tool onto the host machine. Click the tab that corresponds to the host machine operating system or environment:

2) Create an Alias for the S3-Compatible Service

Important

The following example temporarily disables the bash history to mitigate the risk of authentication credentials leaking in plain text. This is a basic security measure and does not mitigate all possible attack vectors. Defer to security best practices for your operating system for inputting sensitive information on the command line.

Use the mc alias set command to add an Amazon S3-compatible service to the mc configuration <mc-configuration>.

bash +o history
mc alias set ALIAS HOSTNAME ACCESS_KEY SECRET_KEY
bash -o history
  • Replace ALIAS with a name to associate to the S3 service. mc commands typically require ALIAS as an argument for identifying which S3 service to execute against.
  • Replace HOSTNAME with the URL endpoint or IP address of the S3 service.
  • Replace ACCESS_KEY and SECRET_KEY with the access and secret keys for a user on the S3 service.

Replace each argument with the required values. If you omit the ACCESS_KEY and SECRET_KEY, the command prompts you to enter those values in the CLI.

Each of the following tabs contains a provider-specific example:

MinIO Server

mc alias set myminio https://minioserver.example.net ACCESS_KEY SECRET KEY

AWS S3 Storage

mc alias set myS3 https://s3.amazon.com/endpoint ACCESS_KEY SECRET KEY

Google Cloud Storage

mc alias set myGCS https://storage.googleapis.com/endpoint ACCESS_KEY SECRET KEY

3) Test the Connection

Use the mc admin info command to test the connection to the newly added MinIO deployment:

mc admin info myminio

The command returns information on the S3 service if successful. If unsuccessful, check each of the following:

  • The host machine has connectivity to the S3 service URL (i.e. using ping or traceroute).

  • The specified ACCESSKEY and SECRETKEY correspond to a user on the S3 service. The user must have permission to perform actions on the service.

    For MinIO deployments, see minio-access-management for more information on user access permissions. For other S3-compatible services, defer to the documentation for that service.

Command Quick Reference

The following table lists mc commands:

Note

The MinIO Client also includes an administration extension for managing MinIO deployments. See mc admin for more complete documentation.

The below table does not include those commands.

Command Description
mc alias list
mc alias remove
mc alias set
mc anonymous get
mc anonymous get-json
mc anonymous links
mc anonymous list
mc anonymous set
mc anonymous set-json
mc batch describe
mc batch generate
mc batch list
mc batch start
mc batch status
mc cat
mc cp
mc diff
mc du
mc encrypt clear
mc encrypt info
mc encrypt set
mc event add
mc event ls
mc event rm
mc find
mc head
mc idp ldap add
mc idp ldap disable
mc idp ldap enable
mc idp ldap info
mc idp ldap ls
mc idp ldap policy
mc idp ldap rm
mc idp ldap update
mc idp openid add
mc idp openid disable
mc idp openid enable
mc idp openid info
mc idp openid ls
mc idp openid rm
mc idp openid update
mc idp ldap policy attach
mc idp ldap policy detach
mc idp ldap policy entities
mc ilm restore
mc ilm rule add
mc ilm rule edit
mc ilm rule export
mc ilm rule import
mc ilm rule ls
mc ilm rule rm
mc ilm tier add
mc ilm tier check
mc ilm tier info
mc ilm tier ls
mc ilm tier rm
mc ilm tier update
mc legalhold clear
mc legalhold info
mc legalhold set
mc license info
mc license register
mc license update
mc ls
mc mb
mc mirror
mc mv
mc od
mc ping
mc pipe
mc quota clear
mc quota info
mc quota set
mc rb
mc replicate add
mc replicate diff
mc replicate export
mc replicate import
mc replicate ls
mc replicate resync
mc replicate rm
mc replicate status
mc replicate update
mc retention clear
mc retention info
mc retention set
mc rm
mc share download
mc share ls
mc share upload
mc sql
mc stat
mc support callhome
mc support diag
mc support inspect
mc support perf
mc support profile
mc support proxy
mc support top api
mc support top disk
mc support top locks
mc tag list
mc tag remove
mc tag set
mc tree
mc undo
mc update
mc version enable
mc version info
mc version suspend
mc watch

Configuration File

mc uses a JSON formatted configuration file used for storing certain kinds of information, such as the aliases <mc alias> for each configured S3-compatible service.

For Linux and OSX, the default configuration file location is ~/.mc/config.json.

For Windows, mc attempts to construct a default file path by trying specific environment variables. If a variable is unset, mc moves to the next variable. If all attempts fail, mc returns an error. The following list describes each possible file path location in the order mc checks them:

  1. HOME\.mc\config.json
  2. USERPROFILE\.mc\config.json
  3. HOMEDRIVE+HOMEPATH\.mc\config.json

You can use the --config-dir

Certificates

The MinIO Client stores certificates and CAs for deployments to the following paths:

Linux, MacOS, and other Unix-like systems:

~/.mc/certs/ # certificates
~/.mc/certs/CAs/ # Certificate Authorities

Windows systems:

C:\Users\[username]\mc\certs\ # certificates
C:\Users\[username]\mc\certs\CAs\ # Certificate Authorities

When creating a new alias <minio-mc-alias>, the MinIO Client fetches the peer certificate, computes the public key fingerprint, and asks the user whether to accept the deployment's certificate. If you decide to trust the certificate, the MinIO Client adds the certificate to the certificate authority path listed above.

Note

In testing environments, you can bypass the certificate check for selected MinIO Client commands by passing the --insecure flag.

Global Options

mc

All commands <minio-mc-commands> support the following global options:

--debug

Enables verbose output to the console.

For example, the following operation adds verbose output to the mc ls command:

mc --debug ls play

--config-dir

The path to a JSON formatted configuration file that mc uses for storing data. See mc-configuration for more information on how mc uses the configuration file.

--JSON

Enables JSON lines formatted output to the console.

For example, the following operation adds JSON Lines output to the mc ls command:

mc --JSON ls play 

--no-color

Disables the built-in color theme for console output. Useful for dumb terminals.

--quiet

Suppresses console output.

--insecure

Disables TLS/SSL certificate verification. Allows TLS connectivity to servers with invalid certificates. Exercise caution when using this option against untrusted S3 hosts.

--version

Displays the current version of mc.

--help

Displays a summary of command usage on the terminal.

/reference/minio-mc/mc-alias /reference/minio-mc/mc-anonymous /reference/minio-mc/mc-batch /reference/minio-mc/mc-cat /reference/minio-mc/mc-cp /reference/minio-mc/mc-diff /reference/minio-mc/mc-du /reference/minio-mc/mc-encrypt /reference/minio-mc/mc-event /reference/minio-mc/mc-find /reference/minio-mc/mc-head /reference/minio-mc/mc-idp-ldap /reference/minio-mc/mc-idp-ldap-policy /reference/minio-mc/mc-idp-openid /reference/minio-mc/mc-ilm /reference/minio-mc/mc-legalhold /reference/minio-mc/mc-license /reference/minio-mc/mc-ls /reference/minio-mc/mc-mb /reference/minio-mc/mc-mirror /reference/minio-mc/mc-mv /reference/minio-mc/mc-od /reference/minio-mc/mc-ping /reference/minio-mc/mc-pipe /reference/minio-mc/mc-quota /reference/minio-mc/mc-rb /reference/minio-mc/mc-replicate /reference/minio-mc/mc-retention /reference/minio-mc/mc-rm /reference/minio-mc/mc-share /reference/minio-mc/mc-sql /reference/minio-mc/mc-stat /reference/minio-mc/mc-support /reference/minio-mc/mc-tag /reference/minio-mc/mc-tree /reference/minio-mc/mc-undo /reference/minio-mc/mc-update /reference/minio-mc/mc-version /reference/minio-mc/mc-watch