if that gives you permission denied running as root then you are probably missing something there...
Would also check your folders permissions and users with ls -la
.
if that is a ubuntu I would go full root instead:
sudo -s
cd /opt/gitlab/embedded/bin
./mattermost roles system_admin traxwriter -c /var/opt/gitlab/mattermost/config.json
You also need to ensure that the mattermost folder and config.json folder are right.
Unhappily I don't know how gitlab does its thing so I can't advise further.