Skip to content

Instantly share code, notes, and snippets.

@SomajitDey
Last active March 11, 2022 16:56
Show Gist options
  • Save SomajitDey/256b942ca92a8ee2ab19db9247e3321d to your computer and use it in GitHub Desktop.
Save SomajitDey/256b942ca92a8ee2ab19db9247e3321d to your computer and use it in GitHub Desktop.
Setup current USER such that sudo doesn't ask for password
sudo echo hi # This sudo is to accept the current password, so that it won't ask for password for next few minutes
echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER

To restore the default behavior of sudo asking for password just remove the /etc/sudoers.d/$USER file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment