Pete Freitag Pete Freitag

Setting Lucee Admin Password with CommandBox

Updated: April 23, 2021
coldfusion

One of the recent changes to Lucee is that no longer allows you to enter an admin password from the web based lucee admin if one had not been set yet. This is a great feature for security, but for local development it makes things a bit more cumbersome.

You'll see what I mean when you hit this error message:

No Password Set Yet!

For security reasons it is no longer possible to set the initial password here directly. You will need to configure a password before you can access the Server Administrator.

  • create a file with the name password.txt containing your new password under the root Lucee Server Directory ( /lucee-server/context/password.txt )
  • click "import file", Lucee will then read and configure your new password, afterwards Lucee will automatically delete that file.

Fixing it CommandBox Style with CFConfig

Assuming you already used commandbox to start the server, just make sure you are in the server's root directory and run these two commands from CommandBox:

install commandbox-cfconfig
cfconfig set adminPassword=Password123!

If you already have cfconfig installed, it doesn't hurt to run install commandbox-cfconfig anyways - it will just make sure you have the latest version installed.

On more recent versions of lucee you will need to restart your lucee server for the password to be picked up.

server restart

Another way to go

Here's a great tip from Brad, the guy who invented CommandBox, cfconfig, and author of the yet to be published book 103 CommandBox Tips on another (possibly better) way to do it:

propertyFile set ~/.box.env cfconfig_adminPassword Password123!
install commandbox-cfconfig
install commandbox-dotenv

With this approach you are creating a file in your home directory called .box.env and setting the variable cfconfig_adminPassword=Password123!. When the commandbox-dotenv command is installed it will intercept your server start and load environment variables from some default locations such as ~/.box.env or a file called .env in the root folder of your server.

The advantage of this second approach using the env file in your home directory is that it will apply to every new server you start.

After you run the above commands, you can just restart lucee, hit the Lucee Admin page, and enter your new password. You might also want to choose a different password besides Password123! that's mine! Just kidding.


Like this? Follow me ↯

Setting Lucee Admin Password with CommandBox was first published on September 02, 2020.


FuseGuard Web App Firewall for ColdFusion

The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.

Comments

Just FYI, the steps above work. However, you have to restart the server, not just reload the Lucee admin page. (This could be a new thing, I'm not sure, just now getting into CommandBox usage.) At least as of: CommandBox 5.2.1+00295
by Will B. on 01/20/2021 at 4:41:57 AM UTC
Thanks Will - I noticed that too, I wasn't the case when I wrote the article, but it was the next time I tried it. So I will update the article, thanks for the reminder!
by Pete Freitag on 01/20/2021 at 2:54:58 PM UTC

Post a Comment