How to add wildfly user from server configuration?

865 views Asked by At

I am using Wildfly in a Java application. Here is the configuration on the pom:

<plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>4.0.0.Final</version>
                <configuration>
                    <!--
                         In produzione c'e' JBoss EAP 6.3 => JBoss AS 7.4.0.Final
                         ma tale release non e' disponibile nei repo Maven
                         quindi usiamo la versione piu' simile disponibile
                      -->
                    <version>23.0.0.Final</version>
                    <javaOpts>
                        -Xms64m -Xmx512m -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true
                        -Dorg.jboss.resolver.warning=true
                        -Dsun.rmi.dgc.client.gcInterval=3600000
                        -Dsun.rmi.dgc.server.gcInterval=3600000
                        -Djboss.socket.binding.port-offset=100
                        -Djboss.server.config.dir=${project.build.testOutputDirectory}/configuration
                        ${jacocoAgent}
<!--                        &lt;!&ndash;per eseguire il debug remoto rimuovere il commento dalla riga sottostante-->
<!--                            -Xrunjdwp:transport=dt_socket,address=33333,server=y,suspend=y-->
                    </javaOpts>
                    <port>10099</port>
                </configuration>

I would like to add a new admin user automatically by some initial configuration (e. g. standalone.xml), is it possible, and how? I haven't find any references. Thanks.

1

There are 1 answers

3
Brahim Bessrour On

The add-user.sh script is a command-line tool that allows you to add new users to Wildfly.

1)Go to JBOSS_HOME/bin folder
2)Open CMD and launch the script
-If you are on windows: ./add-user.bat
-If you are using Linux: ./add-user.sh
3)Select the default option a to add a Management user
4)Enter the username and password
5)Add the group or leave it blank if you do not want the user to belong to any groups.
6)Review the information and to confirm type yes

Check this link it might help