May 10, 2026

Resetting My Forgotten Sudo Password on Laravel Forge

I forgot the sudo password for the forge user on a server I provisioned directly through Laravel Forge, with no provider account to fall back on. Here's how I reset it in under a minute using Forge Recipes, no provider dashboard needed.

The Issue

I forgot the sudo password for the forge user on my Laravel Forge server. I had provisioned the server directly through Forge, so I didn't have a separate provider account (like DigitalOcean) to log into and reset things from there.

Forge doesn't store the sudo password, so there's no "view password" button in the dashboard. That meant I had to find another way to reset it.

The Fix

I used Forge's Recipes feature. Recipes are bash scripts that Forge runs on my server as the root user, so they don't need the sudo password to execute.

Here's what I did:

  1. Went to Recipes in my Forge dashboard.

  2. Clicked Create Recipe.

  3. Named it "Reset Sudo Password".

  4. Set the user to root.

  5. Pasted this script (replacing YOUR_NEW_PASSWORD with my actual new password):

    echo "forge:YOUR_NEW_PASSWORD" | chpasswd
    
  6. Saved the recipe.

  7. Clicked Run Recipe, selected my server, and ran it. That was it. The password was reset immediately.

Why It Works

Forge connects to my server via SSH keys as root, so it can run anything as root without needing a password. Recipes are essentially "run this bash script as root" — which makes them perfect for resetting the forge user's password.

Lesson Learned

Save the sudo password in a password manager next time.