Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question

marked as duplicate by BuZZ-dEE, Radu Rădeanu Jun 4 at 23:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 8 down vote accepted

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.

share|improve this answer
    
Thank you very much! –  AyushISM Jun 4 at 19:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.