Use 42Crunch Platform from CLI

42Crunch CLI (command line interface) client lets you use the main features of 42Crunch Platform directly from the command line.

This feature is currently available as a beta, and its development is still ongoing.

Install 42Crunch CLI client

The CLI client is available as a binary for the following operating systems:

You must have an account in 42Crunch Platform that you can use for the CLI client. If you do not yet have an account, click here to sign up.

Run the CLI client

  1. Start the CLI client and run the command 42c init. This creates a configuration file called .42cli stored locally on the default path.
    42c init
  2. Run the 42c setconfig command, and set the base-url that the CLI client uses to point to 42Crunch Platform:
    42c setconfig --base-url <platform address>
  3. To test the connection, run the login command. Credentials are transported securely between the CLI client and 42Crunch Platform:
    42c login --username '<your email>' --password '<your password>'

You are now all set to start using the CLI client. To get more details on the CLI commands and how to use them, run 42c --help.

Specifying a flag in a command automatically means true, so there is no need to specify the Booleans separately.

Point CLI to use your password from password manager

If you do not want to type in your password separately every time you must authenticate to 42Crunch Platform, you can store it in the default password manager of your operating system (for example, Pass in Linux, Keychain in macOs, Credential Manager in Windows 10) and point the CLI client to use it from there.

For more details on how to use your default password manager, see the documentation of your operating system.

If you run the CLI client as a binary, we recommend that you store your password in the default password manager of your operating system, and set your CLI client to use it from there. Your username is stored as part of your client configuration.

For added security, we also recommend using API tokens on the CLI client as much as possible. However, some commands require user credentials and cannot be run with API tokens. The commands that require user credentials are any commands under users, invitations, audit-summaries, tokens, and login.

  1. Run the following 42c setconfig command for your operating system:
    • Linux:

      Make sure that Pass is installed before running the command.

      42c setconfig --base-url <platform address> --username '<your email>' --creds-store pass --password '<your password>'
    • macOS:
      42c setconfig --base-url <platform address> --username '<your email>' --creds-store osxkeychain --password '<your password>'
    • Windows:
      42c setconfig --base-url <platform address> --username '<your email>' --creds-store wincred --password '<your password>'
  2. To test the access, run the login command:
     42c login

    If access is successful, the CLI shows you the UUID of your session.

Your password to 42Crunch Platform is now stored securely in your password manager and the CLI client will use it from there, when it is needed for authentication.