You can pass in the path to the config file, and have to run the command as user mattermost. This is what worked for me:
sudo -u mattermost ./mattermost -assign_role -team_name=“yourteam” -email="you@example.com" -role=“system_admin” -config=/var/opt/gitlab/mattermost/config.json
Note that you have to log out and back into Mattermost for the system admin permissions to be picked up