Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Created July 6, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cecilemuller/76182cd29d74336291e4 to your computer and use it in GitHub Desktop.
Save cecilemuller/76182cd29d74336291e4 to your computer and use it in GitHub Desktop.
Programatically patch sudoers to make group "sudo" passwordless
#!/bin/bash
sudo cp /etc/sudoers /etc/sudoers.bak
sudo cp /etc/sudoers /etc/sudoers.tmp
sudo chmod 0640 /etc/sudoers.tmp
sudo sed -i 's/%sudo ALL=(ALL:ALL) ALL/%sudo ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers.tmp
sudo chmod 0440 /etc/sudoers.tmp
sudo mv /etc/sudoers.tmp /etc/sudoers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment