Skip to content

Instantly share code, notes, and snippets.

@911992
Created August 12, 2020 18:04
Show Gist options
  • Save 911992/a3e300cd6e97965cc677685ac87cbd33 to your computer and use it in GitHub Desktop.
Save 911992/a3e300cd6e97965cc677685ac87cbd33 to your computer and use it in GitHub Desktop.
Adding user to windfly

By default using ./bin/add-user.sh|cmd file should work.

But if add-user.bat result a failed resp by The system cannot find the path specified. message, you may go like following

  1. head into the wildfly root folder.

  2. use following command (template)

java -Djboss.server.config.user.dir=<<address of configuration folder, example: ./standalone/configuration>>
-Djboss.domain.config.user.dir=<<address of domain config folder, example: ./domain/configuration>>
-jar "jboss-modules.jar" -mp "./modules" org.jboss.as.domain-add-user

Example
Considering setup:

wildfly path :    C:\wildfly-20.0.1.Final
domain path  :    C:\wildfly-20.0.1.Final\domain\configuration
config path  :    C:\wildfly-20.0.1.Final\standalone\configuration
pwd          :    C:\wildfly-20.0.1.Final

Command to run:

java -Djboss.server.config.user.dir=./domain/configuration -Djboss.domain.config.user.dir=./domain/configuration -jar "jboss-modules.jar" -mp "./modules" org.jboss.as.domain-add-user
  1. Provide required data as wizard asks

Sample run:

java -Djboss.server.config.user.dir=./domain/configuration -Djboss.domain.config.user.dir=./domain/configuration -jar "jboss-modules.jar" -mp "./modules" org.jboss.as.domain-add-user

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

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : wildfly
User 'wildfly' already exists and is disabled, would you like to...
 a) Update the existing user password and roles
 b) Enable the existing user
 c) Type a new username
(a): a
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password should be different from the username
 - 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)
Password :
WFLYDM0098: The password should be different from the username
Are you sure you want to use the password entered yes/no? yes
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]:
Updated user 'wildfly' to file 'C:\wildfly-20.0.1.Final\standalone\configuration\mgmt-users.properties'
Updated user 'wildfly' to file 'C:\wildfly-20.0.1.Final\domain\configuration\mgmt-users.properties'
Updated user 'wildfly' with groups  to file 'C:\wildfly-20.0.1.Final\standalone\configuration\mgmt-groups.properties'
Updated user 'wildfly' with groups  to file 'C:\wildfly-20.0.1.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? yes
To represent the user add the following to the server-identities definition <secret value="very_secret" />


<secret value="double_very_secret" />
  1. Later you need to add the created user be able to login to managmenet/admin console.

Based on your config file (check standalone/configuration folder), update the related config (e.g. standalone.xml).

Locate following section

<management-interfaces>
	<http-interface security-realm="ManagementRealm">
		<http-upgrade enabled="true"/>
		<socket-binding http="management-http"/>
	</http-interface>
</management-interfaces>
<access-control provider="simple">
	<role-mapping>
		<role name="SuperUser">
			<include>
				<user name="$local"/>
			</include>
		</role>
	</role-mapping>
</access-control>

And add <user name="windfly"/> (where sindfly is the name of created user) after <user name="$local"/> line.

Now enjoy your windfly liek a boss (⌐■_■)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment