LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

In Cowrie's userdb.txt, why must a wildcard entry for root (root:x:*) come after the existing root entries, and what does ! before a password mean?

Cowrie processes the file line by line and stops at the first match, so a wildcard placed first would accept every password before the deny rules are checked. ! means "this password is not accepted".

Cowrie userdb first-match evaluation

* Lines are tried top to bottom and the first match decides, so the exceptions must come before the wildcard. *

Each line has the form username:x:password (the middle field is unused). * matches any username or password, and ! in front of a password denies it:

root:x:!root
root:x:!123456
root:x:*

Read top to bottom, this says: for root, refuse the password root, refuse 123456, and accept anything else.

Because matching stops at the first hit, order is the logic:

  • With root:x:* first, every password, including root and 123456, matches the wildcard, and the deny lines are never reached.
  • With the wildcard last, the specific exceptions are checked first.

Why deny the most obvious passwords at all? A server that accepts root/root looks suspicious to a careful attacker, and an attacker who succeeds with any password soon realises it is fake. Refusing a few obvious guesses makes the honeypot more believable, while still letting the attacker in after a couple of tries so their activity can be recorded.

Go deeper:

From Quiz: ISLAB / Network Security Monitoring | Updated: Nov 26, 2026