Modify and Reset Root Password
Guide on initial activation, regular updates, and CLI password resets for the self-hosted FastGPT root administrator account
The default administrator username in FastGPT is root. Starting from version v4.17.3, FastGPT introduces an account activation mechanism and a built-in password reset command-line tool. It removes the legacy behavior of overwriting the administrator password on every container restart via the DEFAULT_ROOT_PSW environment variable, improving the security of administrator accounts.
This guide explains how to change or reset the root password across different scenarios.
Scenario 1: Initial Deployment Login and Activation
In version v4.17.3 and later, newly created FastGPT instances have a fixed default initial password of 123456, and the account is initially set to inactive.
- Open the FastGPT web access address in your browser.
- Sign in with the administrator credentials:
- Username:
root - Initial Password:
123456
- Username:
- After logging in, a non-dismissible Activate Account dialog will appear, requiring you to set a new password.
- Enter and confirm your new password to complete activation. Once activated, the system becomes available for normal use. Keep your new password in a safe place.
To protect system security, you must complete the activation and set a new password on your first login before you can use system features.
Scenario 2: Regular Password Updates in the Web UI
If you know the current password and are currently logged in, you can update your password directly through the web interface:
- Sign in to the FastGPT platform as
root. - Click your user avatar in the upper right corner to navigate to Account Info.
- Under the security settings section, locate Change Password and open the modal dialog.
- Enter your current password (old password) and the new password, then save your changes.
- The new password takes effect immediately.
Scenario 3: Resetting Password via CLI When Forgotten
If you forget the root password and cannot log into the web interface, you can run the built-in password reset script directly inside the FastGPT application container.
This script connects directly to MongoDB to update the password digest. It does not require restarting the service container and will not interrupt running tasks.
1. Docker Compose Deployments
Navigate to the deployment directory containing docker-compose.yml on your server and run:
docker compose exec fastgpt-app node /app/scripts/reset-root-password.cjs 'your_new_password'If you are using an older Docker Compose version (standalone binary), replace docker compose with docker-compose:
docker-compose exec fastgpt-app node /app/scripts/reset-root-password.cjs 'your_new_password'2. Standalone Docker Container
If running FastGPT with docker run, execute the command using the container name or ID:
docker exec -it <container_name_or_id> node /app/scripts/reset-root-password.cjs 'your_new_password'3. Kubernetes / Helm Deployments
In a Kubernetes cluster, run the command inside the FastGPT Pod using kubectl exec:
kubectl exec -it <fastgpt-pod-name> -n <namespace> -- node /app/scripts/reset-root-password.cjs 'your_new_password'Verification
When the operation succeeds, the terminal outputs:
root 密码已重置Existing sessions will no longer be valid after the reset, and you can immediately log into the web interface using the new password.
If your new password contains special characters (such as $!#), wrap the password argument in single quotes ' ' on the command line to prevent your host shell from interpreting or expanding them.
Scenario 4: Legacy Versions (v4.17.2 and Earlier)
For version v4.17.2 and earlier, the built-in CLI script is not available, and the root password is controlled by environment variables:
- Open
docker-compose.ymlin your deployment directory. - Locate the
DEFAULT_ROOT_PSWenvironment variable (or thex-default-root-pswYAML anchor) and update its value to your desired password. - Restart the FastGPT service to apply the change:
docker compose down docker compose up -d - During container startup, the database
rootpassword will be automatically updated to the value specified in the environment variable.
Last updated