Use the code42 profile set of commands to establish the Code42 environment you’re working within and your user information.
User token authentication
Use the following command to create your profile with user token authentication:
code42 profile create --name MY_FIRST_PROFILE --server example.authority.com --username firstname.lastname@example.org
Your profile contains the necessary properties for authenticating with Code42. After running
code42 profile create,
the program prompts you about storing a password. If you agree, you are then prompted to enter your password.
Your password is not shown when you do
code42 profile show. However,
code42 profile show will confirm that a
password exists for your profile. If you do not set a password, you will be securely prompted to enter a password each
time you run a command.
API client authentication
Once you’ve generated an API Client in your Code42 console, use the following command to create your profile with API client authentication:
code42 profile create-api-client --name MY_API_CLIENT_PROFILE --server example.authority.com --api-client-id 'key-42' --secret 'code42%api%client%secret'
Remember to wrap your API client secret with single quotes to avoid issues with bash expansion and special characters.
You can add multiple profiles with different names and the change the default profile with the
code42 profile use MY_SECOND_PROFILE
When you use the
--profile flag with other commands, such as those in
security-data, that profile is used
instead of the default profile. For example,
code42 security-data search -b 2020-02-02 --profile MY_SECOND_PROFILE
To see all your profiles, do:
code42 profile list
Profiles with Multi-Factor Authentication
If your Code42 user account requires multi-factor authentication, the MFA token can either be passed in with the
option, or if not passed you will be prompted to enter it before the command executes.