linux – Keeping the fancy sudo warning forever – Super User
Posted by jpluimers on 2018/12/21
Be careful what you do: blindly following Super User can make sudo unavailable: [WayBack] linux – Keeping the fancy sudo warning forever – Super User.
Following the answer archived in the WayBack machine gets you into this situation:
sudo -i
>>> /etc/sudoers.d/privacy: syntax error near line 1 <<<
sudo: parse error in /etc/sudoers.d/privacy near line 1
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
The cause:
I forgot to put a line terminator at the end of the line in the privacy file.
If you do that, then it works fine: add this line INCLUDING A LINE TERMINATOR to /etc/sudoers.d/privacy
(any file in that directory will do):
Default lecture=always
Related
- “We trust you have received the usual lecture from the local System” – Google Search
- [WayBack] Terminal welcoming message – Ask Fedora: Community Knowledge Base and Support Forum
- [WayBack] linux – Keeping the fancy sudo warning forever – Super User
The first time I do
sudo
on openSUSE I’m always warned with a someway fancy messageWe trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. root's password:
After the first successful login I won’t be warned again.
I’d like to be always warned. I find this message someway fancy. Is there any way to be warned like that by sudo prompt?
- [WayBack] linux – Changing the Sudo warning – Server Fault
Happily, however, my
man sudoers
admits of the stringlecture_file
which it says is the[p]ath to a file containing an alternate sudo lecture that will be used in place of the standard lecture if the named file exists. By default, sudo uses a built-in lecture.
So see if your sudo supports that, and if it does, set it to a particular filename with e.g.
Defaults lecture_file = /etc/sudoers.lecture
and put your lecture text in that file. You may find this easier to test, as I did, if you also do
Defaults lecture = always
which will display the lecture on every invocation of sudo. Otherwise you may run out of accounts which have never sudo’ed while you get this right!
–jeroen
Leave a Reply