Thank you for the response!
The mattermost cli that comes bundled with GitLab Community Edition is in the following directory, not in the /var/opt/gitlab/mattermost/bin directory:
/opt/gitlab/embedded/bin
So, I cd to the /opt/gitlab/embedded/bin directory.
I don't think I have an Admin team so I'll use the team wtas which is one of the ones I need to delete.
sudo su mattermost ./mattermost team delete wtas -c /var/opt/gitlab/mattermost/config.json
gives me
./mattermost: /var/opt/gitlab/mattermost/config.json: Permission denied
even though config.json is owned by mattermost
The command
sudo -u mattermost ./mattermost team delete wtas -c /var/opt/gitlab/mattermost/config.json
give me
Have you performed a database backup? (YES/NO): YES
Are you sure you want to delete the teams specified? All data will be permanently deleted? (YES/NO): YES
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x414f58]
goroutine 1 [running]:
panic(0xc72560, 0xc4200100c0)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
main.getTeamFromTeamArg(0x7ffe02d8b8ac, 0x4, 0x1)
/home/ubuntu/workspace/msr/platform-release/src/github.com/mattermost/platform/cmd/platform/teamargs.go:21 +0x28
main.getTeamsFromTeamArgs(0xc42069e480, 0x1, 0x3, 0x3, 0x1, 0x0)
/home/ubuntu/workspace/msr/platform-release/src/github.com/mattermost/platform/cmd/platform/teamargs.go:13 +0xa2
main.deleteTeamsCmdF(0x11475a0, 0xc42069e480, 0x1, 0x3, 0x0, 0x0)
/home/ubuntu/workspace/msr/platform-release/src/github.com/mattermost/platform/cmd/platform/team.go:186 +0xdf
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).execute(0x11475a0, 0xc42069e3f0, 0x3, 0x3, 0x11475a0, 0xc42069e3f0)
/home/ubuntu/workspace/msr/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:643 +0x23e
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc421152240, 0x0, 0x0, 0x0)
/home/ubuntu/workspace/msr/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:734 +0x367
github.com/mattermost/platform/vendor/github.com/spf13/cobra.(*Command).Execute(0xc421152240, 0xc420010770, 0xb)
/home/ubuntu/workspace/msr/platform-release/src/github.com/mattermost/platform/vendor/github.com/spf13/cobra/command.go:692 +0x2b
main.main()
/home/ubuntu/workspace/msr/platform-release/src/github.com/mattermost/platform/cmd/platform/mattermost.go:50 +0x49f