This guide explains how to reset a lost admin password on a FortiGate firewall. Previously (before FortiOS 7.2.4), a "maintainer" account backdoor using the serial number was available. This is no longer functional on newer firmware versions, requiring a different approach involving a configuration backup and a factory reset.
Critical: This method requires you to have a backup of your firewall's configuration file. If you are already locked out and do not have a backup, you cannot restore your previous settings using this method.
If you have access or are preparing for the future:
.conf file.To clear the current locked state, we must factory reset the physical device.
While the firewall resets, we will modify our backup file to remove the old password.
Open your .conf backup file using a text editor like Notepad++. Setting the language to YAML can help with readability.
Search for the admin user configuration block:
config system admin
Locate the specific admin user entry. You will see a line starting with set password followed by an encrypted hash string.
Action: Delete this entire line.
set password ENC ... [Delete this line]
Save the modified file. When we load this back into the system, the firewall will interpret the missing password line as a request to set a new password upon login.
Once the firewall is online (default IP is typically 192.168.1.99), connect a standard Ethernet cable to a LAN port.
Log in with the default credentials:
You will immediately be prompted to create a new password for this factory-reset state. Enter a temporary password.
Navigate to the admin menu (top right) and select Configuration > Restore.
After the reboot, access the Web GUI again.
The system will now prompt you to set a new password for your restored configuration. Enter your desired secure password. Once logged in, you will see your original dashboard, themes, and interfaces are fully restored.