Skip to content

Instantly share code, notes, and snippets.

@StanGenchev
Last active October 16, 2020 11:42
Show Gist options
  • Save StanGenchev/c279b71c1980908c6e73af3478230de2 to your computer and use it in GitHub Desktop.
Save StanGenchev/c279b71c1980908c6e73af3478230de2 to your computer and use it in GitHub Desktop.
Create passwordless sudo user in Linux

Create passwordless user in Linux:

Create the user

adduser <user>

Remove password in RedHat/CentOS/Fedora Linux:

passwd -f -u <user>

Remove password in Debain/Ubuntu Linux:

passwd --delete <user>

Grant sudo permissions in RedHat/CentOS/Fedora Linux:

usermod -aG wheel <user>

Grant sudo permissions in Debain/Ubuntu Linux:

usermod -aG sudo <user>
nano /etc/sudoers

At the end of the file add this line - <user> ALL=(ALL) NOPASSWD: ALL If you want to disable sudo password for all users, replace %sudo ALL=(ALL:ALL) ALL with %sudo ALL=(ALL:ALL) NOPASSWD: ALL

Grant sudo permissions in any Linux OS from Google Cloud Platform:

usermod -aG google-sudoers <user>
usermod -aG adm <user>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment