0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mattermostで特定ユーザーのユーザー名を変更する方法(管理者向け)

Last updated at Posted at 2025-03-29

こんにちは!
今回は Mattermostの管理者が特定ユーザーのユーザー名(例:@john_doe@john)を変更する方法について解説します。

:dart: 目的

Mattermostの管理者が、ユーザーに代わってユーザー名を変更したいときに使える手順です。
対象は自社運用しているMattermostサーバーで、mmctl(CLIツール)を使った方法になります。

:white_check_mark: 前提条件

  • MattermostサーバーにSSHなどでアクセスできる
  • mmctl が使える(v6.7以降で動作確認)
  • サーバー上で Mattermostと同じユーザー権限 で操作できること

:tools: ユーザー名変更手順

mmctlがある以下のディレクトリに移動します。

cd /opt/mattermost/bin

mmctl をローカルモードで実行する

まずは Mattermost サーバー上にログインし、mmctl をローカルモードで使用して対象ユーザーを検索します:

sudo -u mattermost ./mmctl --local user search john_doe

実行例:

id: 2fg4xjjzof88jj4qa5yo3je7ow
username: john_doe
email: johndoe@example.com

user username コマンドでユーザー名を変更

上記で取得したユーザーIDを使って、以下のコマンドでユーザー名を変更します:

sudo -u mattermost ./mmctl --local user username 2fg4xjjzof88jj4qa5yo3je7ow john

成功すると:

User john updated successfully

:white_check_mark: 補足:--local モードとは?

Mattermostサーバーと同じホスト上で mmctl を使う場合に限定して、認証なしで直接操作できるモードです。

もし次のようなエラーが出たら:

Error: failed to create client: socket file "/var/tmp/mattermost_local.socket" doesn't exist

以下の2つを確認してください:

  1. config/config.json"EnableLocalMode": true になっているか
  2. サーバーを再起動したか

さらに、次のエラーが出た場合:

Error: failed to create client: owner of the file must be the same user running mmctl

これは mmctl を実行しているユーザーが mattermost と違うためです。
その場合は以下のように実行しましょう:

sudo -u mattermost ./mmctl --local ...

🧪 確認

変更後は以下のコマンドで正しく変更されているか確認できます:

sudo -u mattermost ./mmctl --local user search john

:pencil: まとめ

操作 コマンド例
ユーザー検索 mmctl --local user search <旧ユーザー名>
ユーザー名変更 mmctl --local user username <user-id> <新ユーザー名>

✨ おわりに

MattermostではGUIからはユーザー名を変更できない場合もあるため、CLI操作を覚えておくと非常に便利です。
チーム内の命名ルールの統一やユーザー管理にも役立ちます。

質問やトラブルがあればぜひコメントください!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?