When you run any command as root, using sudo, the password is remembered for 15 minutes by default.
If you want to change the time that the password is cached, open the terminal (as root) and run:
[precode]nano /etc/sudoers [/precode]
Search for this line:
And change it into:
[precode]defaults env_reset , timestamp_timeout=x[/precode]
where “x” is the time in minutes that the password will be cached.
Save and exit and work is done!