Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

When logging in to my PC, and the password is correct, the login takes place nearly instantaneously. When the password is wrong, it takes a few seconds of waiting until the hint "The password is not correct." shows up.

The same thing happens on the terminal with sudo. But why?

I am pretty sure that the passwords hashes are saved and get compared to the hashes of entered passwords. But wouldn't it take longer to confirm the hashes are identical?

share|improve this question

marked as duplicate by jw013, Ramesh, slm linux May 16 '14 at 15:09

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.

up vote 1 down vote accepted

Password failures have an intentional delay introduced in a attempt to make password cracking a slow process. If a failure replied as quickly as a success, then a dictionary attack would finish in no time at all.

share|improve this answer

The PAM config has multiple services to check. When you get the password wrong, it has to check all of these services, which takes additional time - there may also be a deliberately added timeout on a failed check. When you get the password correct, it exits the stack as soon as it can with a successful result, so it doesn't necessarily have to check all of it's configured resources.

share|improve this answer

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