How to silently change admin password and enable secure admin on Payara

Mert Çalışkan
1 min readJan 1, 2017

--

While installing Payara on Amazon EC2 instances, I wanted to enable accessing the admin console remotely. This is easy to handle with change-admin-password and enable-secure-admin asadmin commands but since I am using Cloudformation for shaping up my EC2 cluster and installing Payara onto them, asadmin commands that prompt for user information and password is no good. It’s because I’m heavily dependant on Cloudformation’s bash script execution mechanism.

For executing change-admin-password and enable-secure-admin asadmin commands you need to provide user and passwordfile attributes to those commands as:

asadmin --user admin --passwordfile /path/to/old_passwordfile.txt change-admin-passwordasadmin --user admin --passwordfile /path/to/new_passwordfile.txt enable-secure-admin

The content of the old_passwordfile.txt could be like:

AS_ADMIN_PASSWORD=
AS_ADMIN_NEWPASSWORD=MyPassyRocks*

where I state that asadmin password is empty and the new one will be MyPassyRocks*. And the content of the new_passwordfile.txt could be like:

AS_ADMIN_PASSWORD=MyPassyRocks*

where I state the changed asadmin password. With this configuration it’s possible to change the asadmin password without any prompting for user info and passwords.

--

--

Mert Çalışkan

Opsgenie Champion at Atlassian. Oracle Java Champion. AnkaraJUG Lead. Author of Beginning Spring & PrimeFaces Cookbook.