I have a glassfish server runing. it has 3 different domains - d1,d2, and d3. now when I try to run asadmin enable-secure-admin
command, how to i specify which
asadmin --host www.yourdomain.com --port 4848 enable-secure-admin
Then stop/start glassfish immediately after enabling secure admin.
In case your private Glassfish runs on shared server you will need to use your custom port (assume 15123 for the example) in asadmin command. Check Java Control Panel for your Glassfish console port. Use the port with your asadmin commands. The below was tested with Glassfish 3.1.2 and 4.0.
[~]# asadmin --port 4848 enable-secure-admin
remote failure: At least one admin user has an empty password, which secure admin does not permit. Use the change-admin-password command or the admin console to create non-empty passwords for admin accounts. Command enable-secure-admin failed.
Set the password as prompted
[~]# asadmin --port 4848 change-admin-password Enter admin user name
[default: admin]> Enter admin password> Enter new admin password>
secret Enter new admin password again> secret Command
change-admin-password executed successfully.
Now retry enable-secure-admin
asadmin --port 4848 enable-secure-admin
Enter admin user name> admin
Enter admin password for user "admin"> secret
You must restart all
running servers for the change in secure admin to take effect. Command
enable-secure-admin executed successfully.
More information Glassfish: Secure Admin Must Be Enabled To Access The DAS Remotely
THIS
asadmin --host localhost --port 4848 enable-secure-admin
asadmin --host localhost --port 5858 enable-secure-admin
asadmin --host localhost --port 6868 enable-secure-admin
won't work.
First. the command asadmin should not be included here, it confuses people, it should be asadmin>, which denotes that asadmin is the command prompt, not a command that should be typed in
Second the correct way of enabling secure admin for a domains is enable-secure-admin --host youehornamehere --port youradminportforthatdomain
To check the each domain's port, execute this command:
asadmin list-domains --long=true
Then, see the output and check the ports and domain's states. After that, execute the command to enable secure admin.
My output:
DOMAIN ADMIN_HOST ADMIN_PORT RUNNING RESTART_REQUIRED
domain1 localhost 4848 false false
saovicente localhost 4848 true false
Command list-domains executed successfully.
Before being able to enable Security, You might be prompted with a message saying your admin password is empty and cannot enable security.
To solve the problem:
Change the password of admin this way:
asadmin --host localhost --port 4848 change-admin-password
It will prompt you with user, type "admin", admin password, retype admin password
Once this is done, enable the security with the following command:
asadmin --host localhost --port 4848 enable-secure-admin
This should fix the problem.
You must specify the port the DAS (Domain Administration Server) is running on. For example:
asadmin --host localhost --port 4848 enable-secure-admin
asadmin --host localhost --port 5858 enable-secure-admin
asadmin --host localhost --port 6868 enable-secure-admin
Of course, this assumes the ports are for d1, d2, and d3 respectively.
Hope this helps.