Java

Add user to Wildfly

This tutorial will show how to add a user to Wildfly, so that this new user can manage the application server.

Pre-requisites

User

Before continue, make sure your Wildfly is started.

Usually, when accessing your administrative page for the first time by the link http://localhost:8080/ and clicking Administration Console, it is possible that the Wildfly still has no users and the following message appears:

In this case, let’s create a new user so you can log in and manage the application server.

To begin, go to the bin directory of you Wildfly and run the command below:

cd /opt/wildfly-8.2.0.Final/bin
./add-user.sh

Next, you will be asked about that user type you want to create. The type we want is the Management User that is pre-defined already, so just hit Enter:

What type of user do you wish to add? 
 a) Management User (mgmt-users.properties) 
 b) Application User (application-users.properties)
(a):

On the next step you will choose an username. Type the desired username and hit Enter:

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : bgasparotto

Then you must choose a password, preferably following the listed recommendations:

Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should not be one of the following restricted values {root, admin, administrator}
 - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
 - The password should be different from the username
Password :

Re-enter your password:

Re-enter Password :

On the next step, it will be proposed that you associate your new user to some group, however, we are not going to do that this time, so simply hit Enter:

What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]:

A message asking for your confirmation will be displayed, type yes to confirm:

About to add user 'bgasparotto' for realm 'ManagementRealm'
Is this correct yes/no? yes

A series of messages will be displayed showing the locations where the user was added, lastly, it will be asked if the user is going to be used to connecting across the application server processes, type no to finish:

Added user 'bgasparotto' to file '/opt/wildfly-8.2.0.Final/standalone/configuration/mgmt-users.properties'
Added user 'bgasparotto' to file '/opt/wildfly-8.2.0.Final/domain/configuration/mgmt-users.properties'
Added user 'bgasparotto' with groups  to file '/opt/wildfly-8.2.0.Final/standalone/configuration/mgmt-groups.properties'
Added user 'bgasparotto' with groups  to file '/opt/wildfly-8.2.0.Final/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process? 
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? no

Access the link http://localhost:9990/console/App.html and will be asked for a username and password. Type the username and password that you created, then you will be redirected to the administration console:

Hope it helps. Cya!

bgasparotto

View Comments

  • I had a remote server for a user in my JBPM workbench , I removed the remote server .Could my remote server be reestablished by adding the user again ?

  • To me appear a message when i execute add-user.bat:
    The system cannot find the path specified.
    Could you help me?

  • Add-user.sh just adds the user to mgmt-users.properties.
    If you're working with Docker, a very useful approach is add the users what you want in this way, then copy the mgmt-users.properties.
    In this way, you can take a set of users to the wildfly containers you want, simply adding an instruction COPY in Dockerfile
    COPY ./mgmt-users.properties /opt/jboss/wildfly/domain/configuration/
    COPY ./mgmt-users.properties /opt/jboss/wildfly/standalone/configuration/

    Thanks for sharing your knowledge in this clear way! Nice post.

    • That is indeed a nice approach when you are creating your own Dockerfile, thanks for sharing =]

  • C:\JAVAEE\wildfly-8.2.0.Final\wildfly-8.2.0.Final\bin>add-user.bat
    Le chemin d’accès spécifié est introuvable.
    Appuyez sur une touche pour continuer...

    j'ai pas compris cette erreur pourqoui

    • Did you run "dir" command to make sure the "add-user.bat" exists in this directory?

Recent Posts

Python function decorator

This guide will show you how to create a Python function decorator with a few…

2 years ago

Got permission denied while trying to connect to the Docker daemon socket

This guide will show you how to fix the error Got permission denied while trying…

2 years ago

Python virtual environment on Intellij IDEA

This guide will show you how to create a Python virtual environment on Intellij IDEA…

2 years ago

Find and kill processes on Linux and Mac by port number

This tutorial will quickly show you how to to find and kill processes on Linux,…

2 years ago

Python: Relocation R_X86_64_PC32 against symbol can not be used when making a shared object Error

This guide shows a possible solution for Python error Relocation R_X86_64_PC32 against symbol can not…

2 years ago

Kubernetes useful commands

I condensed below a cheat sheet of Kubernetes useful commands. I will keep updating this…

2 years ago