Authenticating Meshery via CLI
mesheryctl needs a token to call Meshery Server on your behalf. Run mesheryctl system login to get one. Meshery Server must be running first, so start it with mesheryctl system start if it is not.
Log in from a machine with a browser
Run the login command:
mesheryctl system loginmesheryctlasks Meshery Server which providers it offers and prompts you to pick one:Use the arrow keys to navigate: โ โ โ โ ? Select a Provider: โธ Meshery LocalThe list comes from your server, so it shows any additional remote providers your server is configured with. To skip the prompt, name the provider with
-p, for examplemesheryctl system login -p Meshery. Runmesheryctl system provider listto see the names.Choose a provider:
- Meshery (or another remote provider) opens your browser at the provider’s sign-in page. After you sign in, the page says “you have logged in, you can close this window now”. Close it and return to your terminal. A remote provider keeps your designs, environments, and performance results between sessions.
- Local signs you in without a browser. Your work stays on this Meshery Server only.
Confirm that
mesheryctlprintedauthenticatedand that it saved the token to~/.meshery/auth.json:ls -l ~/.meshery/-rw------- 1 ubuntu ubuntu 39 Dec 21 06:13 auth.json -rw-rw-r-- 1 ubuntu ubuntu 260 Dec 21 06:04 config.yaml -rw-rw-r-- 1 ubuntu ubuntu 988 Dec 21 06:04 meshery.yamlmesheryctlwrites the token to the file that the current context’s token entry points to in~/.meshery/config.yaml. That file is~/.meshery/auth.jsonunless you changed it withmesheryctl system token. The token file is readable only by you (mode0600);mesheryctl system loginalso tightens an existing token file that an older release left readable by other users. On Windows, where file modes do not control access,mesheryctlinstead replaces the file’s access control list so that only your user account can access it, stops it inheriting permissions from its folder, and checks the result before reporting success.
Log in from a machine without a browser
If mesheryctl runs on a machine with no browser, such as a remote server or a CI runner, download a token from Meshery Cloud and copy it onto that machine.
Go to https://cloud.meshery.io/security/tokens and sign in. Check that you are in the right organization, then click Create.
Enter a token name and purpose, then click Create.
Click the Download icon to download the token as
auth.json.Copy
auth.jsonto~/.meshery/auth.jsonon the machine that runsmesheryctl. To keep the file somewhere else, register its path as a token and attach it to your context:mesheryctl system token create my-token -f /path/to/auth.json --setRun
mesheryctl system checkand confirm that it reports no authentication error.
Log out
mesheryctl system logout empties the token file for the current context. Run
mesheryctl system login again to get a new token.
In a Local provider context, the empty token is valid for Local operation.
Remote provider commands stop with an authentication error after logout; they do
not accept the empty token as valid authentication.
For every mesheryctl command and flag, see the mesheryctl command reference.


