mmctl requires authentication, even if you’re on the same server as the Mattermost application server is running, but you can circumvent the username/password authentication by using local socket based authentication, which basically means that you can connect internally to the Mattermost server, without the extra need to authenticate yourself.
In order to do that, you would have to add the --local flag to mmctl and you will need to enable the local authentication mode and restart your Mattermost server for the changes to become active.
To enable local mode, open your Mattermost server’s config.json file and search for EnableLocalMode which most likely is set to false in your environment. Change it to true, restart the server and the mmctl command from above (with the additional --local flag added) should work now.
If you’re using a docker deployment, you will have to use the environment variable MM_SERVICESETTINGS_ENABLELOCALMODE instead of modifying the config.json directly.