Setting Lucee Admin Password with CommandBox
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.
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 ↯Tweet Follow @pfreitag
Setting Lucee Admin Password with CommandBox was first published on September 02, 2020.
The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.