Open Terminal and type:
sudo visudo
Then scroll down to the line that reads:
Defaults env_reset
And change it to:
Defaults env_reset,timestamp_timeout=0
You can change
0 to any values (time in minutes). Setting it to
0 will ask for your password every time and
-1 will make it never ask. The default is
15 according to
man sudo 8, but
some manuals say the default is
5. Have a look at the
RootSudoTimeout wiki for more information.
Press
CTRL +
X to finish editing,
Y to save changes, and
ENTER to exit.