How I can make sudo session an hour and not few minutes in Ubuntu 10.04?

Disclaimer: This is not recommended for security reasons! One of the reasons why Linux is so safe are the user privileges.

You can edit the sudo settings file with the following command:

  sudo visudo

And then change the line

  Defaults      env_reset

to

  Defaults      env_reset,timestamp_timeout=x

x is in minutes by the way. A negative value for x such as -1 will cause sudo to ask for user password only once per session.

  Defaults:user      timestamp_timeout=x

will apply the setting only to the named user.

One word of warning: Do not edit this file with another editor/command! visudo will perform sanity checks before actually saving the file, making sure that you did not break it. If you lock yourself out of your system, reboot into single-user/recovery mode and run visudo there.


Instead of making the sudo session longer, you could actually log in as root.

sudo su

Anything you do afterwards is done as root. You don't even have to enter sudo anymore.

You can log out any time you want.

exit

You can use pamusb.

"pam_usb provides hardware authentication for Linux using ordinary USB Flash Drives "