Whenever we use the sudo command , the password is saved for 15 mins by default . But we can change the time by using simple method .
Step 1 : Go to terminal and run the following command
sudo visudo
Step 2 : Now search the below line .
defaults env_reset
change the above line into
Defaults env_reset , timestamp_timeout=x
where x is the remembering time.
Press Ctrl + x to save .