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 am trying to place a restriction on my ssh box to require a password of a min. length of 16 character and a max. of 30.

I was following the Password policy section, in the official user documentation and set the following in /etc/pam.d/common-password:

password        [success=1 default=ignore]      pam_unix.so obscure min=16 max=30 sha512

However when I turn on ssh, as a regular user, and go to change my password via passwd, I am restricted to a minimum of only 8 characters.

Would anyone have any ideas as to why the min. of 16 is not being recognised or it was something I have overlooked?

OS is Ubuntu Server 10.04.

share|improve this question
    
Take a look at this question too: askubuntu.com/questions/180402/… It seems somehow related. –  NlightNFotis Sep 6 '12 at 8:12
add comment

1 Answer 1

This is a bit old but for in order to help others here's what I've found.

minlen is not just a basic character length restrictor, it it more a score that takes a number of criteria into account

source:

The minlen complexity measure is calculated in a number of steps:

  • every character in a password yields one point, regardless of the type of character
  • every lowercase letter adds one point, but only up to the value of lcredit
  • every uppercase letter adds one point, but only up to the value of ucredit
  • every digit adds one point, but only up to the value of dcredit
  • every special character adds one point, but only up to the value of ocredit

What I was seeing was a minlen of 16 allowing passwords of 8 characters as I was getting 2 points per character typed.

This is also documented in man 8 pam_cracklib:

The minimum acceptable size for the new password (plus one if credits are not disabled which is the default). In addition to the number of characters in the new password, credit (of +1 in length) is given for each different kind of character (other, upper, lower and digit). The default for this parameter is 9 which is good for a old style UNIX password all of the same type of character but may be too low to exploit the added security of a md5 system. Note that there is a pair of length limits in Cracklib itself, a "way too short" limit of 4 which is hard coded in and a defined limit (6) that will be checked without reference to minlen. If you want to allow passwords as short as 5 characters you should not use this module.

share|improve this answer
    
I doubt that is the case. Have you tried rebooting the machine and then see what happens when you attempt to change the password? –  NlightNFotis Sep 6 '12 at 8:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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