SuperGeekery: A blog probably of interest only to nerds by John F Morton.

A blog prob­a­bly of inter­est only to nerds by John F Mor­ton.

Reset the forge sudo password in Laravel Forge

Recipe new sudo pw

The narration of this post was created with Bespoken plugin for Craft CMS.

Have you mis­placed the sudo pass­word for your user and need to reset it? 

In Lar­avel Forge, you can save reusable bash scripts in the con­trol pan­el and run them as the root user. Save the fol­low­ing in a Recipe, updat­ing NEW_SUDO_PASSWORD with your desired pass­word each time. If you’re reset­ting a user oth­er than forge, update the user. Run it on your serv­er. Presto! You’ve got your sudo pass­word back. The same script also works if you have root SSH access through your provider, like Dig­i­tal Ocean.

The bash script reads: echo. forge. colon. new sudo pass­word. fol­lowed by a pipe sym­bol. and C. H. P. A. S. S. W. D.

echo "forge:NEW_SUDO_PASSWORD" | chpasswd