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?

wildflyの管理ユーザーの追加

Posted at

はじめに

tomcatからwildflyに切り替えました。数年前たったので、バージョンアップを試みました。

バージョンアップ前: Wildfly29 (2023/08/26)
バージョンアップ後: Wildfly35 (2025/02/06)
Javaのバージョン 17

管理ユーザーを追加しようと思いましたが、数年前たって、忘れかけているので、自分用にメモを残します。

add-user

ユーザーを追加するのは add-user で出来ます。
しかし、 adminというユーザは既に登録されています。
これを上書きするべきなのか、別のユーザIDをつくるべきなのか、よくわからなかったのでChartGPTに聞いてみました。

ベストプラクティス

「admin以外のユーザーID」を作成。
その後、既存のadminを削除するのが良いとの事でした。

必ず、他の管理ユーザー(例: yournameadmin)をadd-user.shで登録してから adminユーザーを削除するようにしましょう。

追加方法

cd /bin
./add-user.sh

選択肢: 1 (Management User)
User name: admin以外
パスワード: お好みで

既存のadminの削除

WildFlyで既定の「admin」ユーザー(管理者ユーザー)を削除する方法は、登録されているユーザー情報ファイルを直接編集する形になります。
以下の手順で削除してください

  1. WildFlyのホームディレクトリへ移動
    通常、WildFlyを解凍した場所(例: /opt/wildfly や /home/wildfly/wildfly-35.0.0.Final など)が です。

  2. 認証ファイルの場所
    standaloneモードの場合、認証情報は /standalone/configuration/ にあります。
    管理ユーザー(managementユーザー)のファイル:
    mgmt-users.properties
    mgmt-groups.properties

  3. 「admin」ユーザーのエントリを削除
    3.1. ファイルのバックアップ
    まず、念のためバックアップを作成します。

cd /standalone/configuration/
cp mgmt-users.properties mgmt-users.properties.bak
cp mgmt-groups.properties mgmt-groups.properties.bak

3.2. adminユーザーの行を削除
(1) mgmt-users.properties
下記のような行があります:

admin=xxxxxxxxxxxxxxxxx

この「admin=...」という行を削除します。
(2) mgmt-groups.properties
下記のような行があります:

admin=Administrators

この「admin=...」という行も削除します。

  1. WildFlyを再起動
    設定を反映させるため、WildFlyを再起動します。

cd /bin
./standalone.sh

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?