Is it possible to extend the time i'm logged as administrator when enter sudo mode from the console?

In the terminal type this to open a file to edit:

sudo visudo

Find this:

Defaults        env_reset

And replace with this:

Defaults        env_reset,timestamp_timeout=NUMBER

Where NUMBER is the number of minutes to time-out.

Then save the file.


Yes, it is possible.

Edit the sudoers file by typing the following at the command prompt:

sudo visudo

Find the section commented with # Defaults specification and look for a line like this:

Defaults  env_reset

Change that line to:

Defaults  env_reset,timestamp_timeout=10

Where you can replace 10 with whatever the number of minutes you'd like for the sudo password to live. Save the changes and you're done.

Edit: if you don't like to use vi you can tell visudo to use another editor. The editor must block until you're done with your edits. Just set the EDITOR environment variable before envoking visudo and it will use that editor instead:

EDITOR=/usr/bin/nano sudo visudo

would use nano to edit the file instead. I recommend you do not use a graphical editor like Sublime Text without knowing how to run the editor, from the command line, in blocking mode (for subl that means calling it with --wait).