Handy sudo Settings
By and large, sudo
on Mac OS X comes setup with some sane defaults. But here’s two lines I add to my /etc/sudoers
file on a fresh install:
Defaults passprompt="%u@%h's password: "
Defaults timestamp_timeout=15
The first line changes the password from something generic:
% sudo whoami
Password:
root
To something a lot more useful:
% sudo whoami
dave@fuji's password:
root
The second line changes the time between needing to re-enter your password from 5 minutes to 15 minutes. This is handy if you’re confident you’re in a fairly secure physical environment, like an iMac at home, and you find sudo
asking for your password too frequently. If you work in a more paranoid physical environment, you may want to keep the timeout at 5 minutes.
Remember to edit the file with visudo(8)
. Don’t edit it directly.
% sudo EDITOR=emacs visudo