0

When I run sudo visudo , what should it contain? Please give me an example of what it should have normally for a sudo user.

Ubuntovative is here
  • 974
  • 1
  • 12
  • 36
  • 2
    What are you trying to do? – damadam Dec 11 '19 at 10:31
  • 2
    Does this answer your question? [How can I restore configuration files?](https://askubuntu.com/questions/66533/how-can-i-restore-configuration-files) or [How to modify an invalid '/etc/sudoers' file?](https://askubuntu.com/questions/73864/how-to-modify-an-invalid-etc-sudoers-file) – Melebius Dec 11 '19 at 10:45
  • I think this is an example of a good question that is still off-topic as too broad because every installation could have a different definition of "normal". – WinEunuuchs2Unix Dec 11 '19 at 12:02

1 Answers1

1

Here's what I change on new installations:

$ sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults    env_reset, timestamp_timeout=120, pwfeedback
#Defaults    mail_badpass
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Defaults:rick !secure_path

  (... SNIP rest of file unchanged ...)

I put my changes at the top of the file. They are displayed in bold above:

  • timeout makes sudo privalege last for 2 hours so I don't have retype password every 5 minutes or whatever the default is.
  • pwfeedback places a * on screen with each key press during password input.
  • mail_badpass stops an email being sent to my account each time I enter the sudo password incorrectly.
  • !secure_path is explained here: Can I make `sudo` follow my path via CLI?
WinEunuuchs2Unix
  • 99,709
  • 34
  • 237
  • 401