Skip to content

Instantly share code, notes, and snippets.

@carlosleonam
Last active December 26, 2021 15:40
Show Gist options
  • Save carlosleonam/f23229eaf2ed83a498c903753398467d to your computer and use it in GitHub Desktop.
Save carlosleonam/f23229eaf2ed83a498c903753398467d to your computer and use it in GitHub Desktop.
Ubuntu/Linux recover lost sudo password (with SSH key access)

Ubuntu recover lost sudo password (with SSH key access)

IMPORTANT!

If you have ROOT access, use these instructions:

Enable sudo without password

https://phpraxis.wordpress.com/2016/09/27/enable-sudo-without-password-in-ubuntudebian/

Requirements

  • Access with SSH key;
  • VSCode remote access with SSH

How to

  • Enable "tab" indentation in VSCode, to avoid damage to sudo configuration;
  • Create and open SSH remote access with VSCode;
  • Open /etc/sudoers
  • Add the following line at the end of the file (DO NOT USE SPACE, ONLY REAL "TABs", one per column):
username     ALL=(ALL) NOPASSWD:ALL
  • Now your SUDO works without a password, change the password and remove or comment out the line entered to maintain security.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment