How to stop OSX from issuing warning for sudo command in terminal?
Asked Answered
A

1

6

I have just updated to OSX Yosemite and every time I execute a sudo command, the OS issues this warning before the password prompt:

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo.

How can this warning be silenced?

Armington answered 21/10, 2014 at 18:29 Comment(4)
Mmmm... how pesky! Mine does that too.Germanophile
Examining /usr/bin/sudo with HexFriend reveals that about halfway through the binary the string "WARNING: Improper use of the sudo command..." is hardcoded. It might be possible to remove this string (it seems like the end of the binary is a list of null-terminated strings separated by newlines), but I'll have to investigate further.Autolysis
I'm not sure exactly how this behaves, but it seems like this message only appears once (perhaps once per reboot).Autolysis
There's an option, lecture, supported by the sudoers file. It defaults to giving that lecture once, but it can be set to always. Check that. If that's not set or already set to once, then the problem may be with the sudo database. That's where it would record that you had already been given the lecture.Pictograph
V
3

To remove the warning, open the sudoers file:

sudo visudo

Add this line (to keep it tidy, just after the other Defaults):

Defaults:al !lecture

I've tried to set it to just "once" (Defaults lecture = once) but that seemed to be ignored.

Voltcoulomb answered 1/6, 2016 at 19:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.