YunoHost-Apps / mattermost_ynh

Mattermost package for YunoHost
http://www.mattermost.org
GNU General Public License v3.0
33 stars 19 forks source link

mattermost user delete -bash: mattermost: command not found #332

Closed svenbrier closed 2 years ago

svenbrier commented 2 years ago

I tried to delete a mattermost test user but the 'mattermost user delete USERNAME' command throws the error 'mattermost: command not found'. How can I delete a mattermost user on YUNOHOST?

kemenaran commented 2 years ago

Yes, that's expected: since Mattermost 6.0 the mattermost binary for command-line operations has been replaced by mmctl (/var/www/mattermost/bin/mmctl).

You'll probably want to look at this: https://docs.mattermost.com/manage/mmctl-command-line-tool.html#mmctl-user-delete

svenbrier commented 2 years ago

Many thanks for your response. Unfortunately, in my case, it did not bring the desired result.

I tried: mmctl user delete test_sven The answer was: -bash: mmctl: command not found

As sudo I was also unsuccessful.

kemenaran commented 2 years ago

You may want to try with the full path to mmctl, and use "local authentication" mode to allow mmctl to connect to a local installation:

  1. Edit Mattermost's config.json file, and set EnableLocalMode to "true":
    sudo sed -i 's/"EnableLocalMode": false/"EnableLocalMode": true/g' /var/www/mattermost/config/config.json
  2. Restart the mattermost server:
    sudo systemctl restart mattermost
  3. Tell mmctl to run using local mode, by setting two environment variables:
    export MMCTL_LOCAL=true
    export MMCTL_LOCAL_SOCKET_PATH=/var/run/mattermost/mattermost_local.socket
  4. Run mmctl with the full path:
    sudo --preserve-env /var/www/mattermost/bin/mmctl user list
kemenaran commented 2 years ago

(I just created a wiki to host these informations: https://github.com/YunoHost-Apps/mattermost_ynh/wiki)

svenbrier commented 2 years ago

Thank you for helping me. I'm sorry to say, that is still not working:

Error: cannot read user credentials, maybe you need to use login first: stat /root/.config/mmctl/config: no such file or directory

Even not as su root.

kemenaran commented 2 years ago

Mmm, I think that means activating local mode didn't work. Oh, I see: sudo didn't pass the environment variables to mmctl.

What if you try using :

export MMCTL_LOCAL=true
export MMCTL_LOCAL_SOCKET_PATH=/var/run/mattermost/mattermost_local.socket
sudo --preserve-env /var/www/mattermost/bin/mmctl user list
svenbrier commented 2 years ago

It worked like a charm! Thank you so, so much! 😄

kemenaran commented 2 years ago

Perfect then 🙇

I updated the wiki with the correct instructions.