2

I am trying to change the password security check.

I would like to set rules for the password when adding a new user.

Here is the content of my /etc/pam.d/common-password file:

password    requisite   pam_cracklib.so retry=3 minlen=15 difok=3
password    [success=1 default=ignore]  pam_unix.so obscure use_authtok try_first_pass sha512
password    requisite           pam_deny.so
password    required            pam_permit.so
password    optional    pam_gnome_keyring.so

But when adding a new user, the system is still accepting for example short passwords! It just says by the 1st try typing the password, that the pass is too short, but when i re-type it, it accepts it!

How can I prevent it? And how can I set the following rules aswell:

  • Minimum length: 15 characters
  • upper- and lower case
  • 1 number must be included
  • 1 symbol must be included
  • 2
    I think you misunderstood a few about that, did you tried to set your own password of unprivileged account? It should accept this rules – user3417815 May 3 '15 at 18:51
  • 1
    I mean, using root you can set any password you want. There is another subset of rules for ALL accounts – user3417815 May 3 '15 at 19:07
  • 1
    Try to set own password of unprivileged account, it will follow your rules – user3417815 May 3 '15 at 19:08
  • 1
    oh, ok. It's /etc/login.defs file, check it out – user3417815 May 3 '15 at 20:14
  • 1
    Possible duplicate of How do you set requirements (such as minimum length) on passwords? – muru Jan 20 '17 at 1:37
1

Please note, you can set any password using root account, there rules accepted for users that trying to change it's own password.

To set password expiration and other parameters for all new users you should check /etc/login.defs file.

Actually your rules looks like correct, I think you just try to set password using root, but superuser (root) should have full access to system and it's not rational to prevent that user to do something.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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