If you have forgotten the administrator user name, you can find it by inspecting the .adminprefs file, as described in the section above, or by inspecting the install_dir/domains/domain1/config/keyfile, where domain1 is the default domain. For a different domain, substitute its name in the path.
If you have forgotten the administrator password, you will need to create a new user name-password pair by removing the user name and password, creating new ones, and restarting the server. (You will not be able to read the password, because it is encrypted in the keyfile.)
Stop the server, if it is currently running.
Change to the appropriate WEB-INF directory; for example:
Comment out the entire <security-constraint\> element in the web.xml file.
Do not delete the element, as you will be reenabling it later. This action disables security for command-line operations.
The commands will still expect a value for --username (or -u) and --password (or -w). But these can be dummy values, since the server side does not impose any security.
Start the server.
At this point, the server does not have command-line security.
Run the following command:
asadmin create-file-user --user <dummy\> --password <dummy\> --userpassword <new_secret\> --groups asadmin <new_user_id\>
This command creates the following new entry:
Uncomment the <security-constraint\> element in web.xml file.
Restart the server for the new user name-password to take effect.
When the server is started, any remote command-line operations will need new_user_id and new_secret as user name and password.