37

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 domain i want to enable?

neo
  • 2,461
  • 9
  • 42
  • 67
  • do you mean `enable-secure-admin` ? and are each domains, d1,d2 &d3 stand alone (DAS) ? – ring bearer Dec 23 '11 at 17:55
  • 1
    i am fairly new to glassfish. I created each domain using asadmin create-domain command. not sure what DAS means... – neo Dec 23 '11 at 17:59
  • Please make this clear - are you trying to enable secure administration of the domains you created? like for example login/password for the admin consoles? – ring bearer Dec 23 '11 at 18:04

5 Answers5

72

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.

Riduidel
  • 22,052
  • 14
  • 85
  • 185
John Clingan
  • 3,324
  • 21
  • 13
29

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.

Pat B
  • 1,915
  • 23
  • 40
  • 3
    Just worked through this with Glassfish 3.1.2.2, default admin password = '' (no password at all), after that entered new password. – fusion27 Sep 06 '13 at 21:21
3

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

Lucian
  • 51
  • 3
0

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.

0

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

Rainier Diaz
  • 65
  • 1
  • 4
  • 2
    I do not think it confuses people. It is correct to include the asadmin command because you can execute those statements directly in the OS prompt; it means, without having to enter the asadmin subenvironment. – Pedro García Medina Oct 10 '17 at 21:16