4

I stopped using Ubuntu for a while (since 12.10) and recently came back to it. From what I remember, it used to only ask for the root password once for a terminal session (for sudo commands). Now it asks me everytime I want to sudo something. Is there a way to fix this? or is this intentional?

The same thing happens with git. I have enter my credentials everytime I want to commit. I know my friends on on mac don't need to do this. Are the two issues related?

Any help would be appreciated. Thanks in advance!

Seth
  • 58,122
AyushISM
  • 43
  • 4

1 Answers1

9

sudo, by default, times out after a certain number of minutes, 15 by default. You can change this by running:

sudo visudo  

Then, at the bottom, add:

Defaults:userName timestamp_timeout=timeoutInMinutes  

Where userName is your username and timeoutInMinutes is the timeout (in minutes) you would like. To always ask for a password, use 0, to only ask once per sessions use -1.

Press Ctrl+O and then Ctrl+X to save and exit.

For git you will need to configure it to remember your username and password. See this Stack Overflow question for more information: How to make Git only ask password when push to remote repository.

Also, your sudo password is not the root password. The root password is the password for the account root (which is disabled by default in Ubuntu). sudo just uses your user's password. A subtle difference, but it is there.

Seth
  • 58,122