Score:0

Need to set Password complexity for root in ubuntu 20.04

aq flag

When i tried to set the password complexity by adding the values in /etc/pam.d/common-password and /etc/security/pwquality.conf. I have set the minlen=8, for other user it works fine for root user its not working.

How i can set the minlen=8 for root user.

Marco avatar
br flag
Reminder: root can change the config anytime.
Score:1
om flag

This is answered in the man page:

enforce_for_root

The module will return error on failed check even if the user changing the password is root. This option is off by default which means that just the message about the failed check is printed but root can change the password anyway.

Simply add enforce_for_root to a line by it self in /etc/security/pwquality.conf.

Note that root can bypass this more or less at will by injecting their password hash. There's ultimately few things that stops root from ignoring configuration on Linux.

Thamizh avatar
aq flag
i have added enforce_for_root in /etc/pam.d/common-password, still root password length was not accepting. pam_pwquality.so retry=3 enforce_for_root
vidarlo avatar
om flag
Not sure I grok your comment?
Thamizh avatar
aq flag
Tell me where i need to add enforce_for_root.
Heslacher avatar
by flag
Maybe reading the provided link could help?
vidarlo avatar
om flag
@Thamizh answer updated :)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.