Are passwords on modern Unix/Linux systems still limited to 8 characters?

后端 未结 6 1228
自闭症患者
自闭症患者 2021-02-01 18:53

Years ago it used to be the case that Unix passwords were limited to 8 characters, or that if you made the password longer than 8 characters the extra wouldn\'t make any differe

相关标签:
6条回答
  • 2021-02-01 19:00

    In glibc2 (any modern Linux distribution) the password encryption function can use MD5/SHA-xxx (provoked by a magic salt prefix) which then treats as significant all the input characters (see man 3 crypt). For a simple test on your system, you could try something like:

    #!/bin/perl -w
    my $oldsalt = '@@';
    my $md5salt = '$1$@@$';
    print crypt("12345678",  $oldsalt) . "\n";
    print crypt("123456789", $oldsalt) . "\n";
    print crypt("12345678",  $md5salt) . "\n";
    print crypt("12345678extend-this-as-long-as-you-like-0", $md5salt) . "\n";
    print crypt("12345678extend-this-as-long-as-you-like-1", $md5salt) . "\n";
    

    (which on my system gives)

    @@nDzfhV1wWVg
    @@nDzfhV1wWVg
    $1$@@$PrkF53HP.ZP4NXNyBr/kF.
    $1$@@$4fnlt5pOxTblqQm3M1HK10
    $1$@@$D3J3hluAY8pf2.AssyXzn0
    

    Other *ix variants support similar - e.g. crypt(3) since at least Solaris 10. However, it's a non-standard extension - POSIX does not define it.

    0 讨论(0)
  • 2021-02-01 19:01

    Are you asking about the crypt algorithm?

    http://linux.die.net/man/3/crypt

    "By taking the lowest 7 bits of each of the first eight characters of the key..."

    "The glibc2 version of this function has the following additional features. ... The entire key is significant here (instead of only the first 8 bytes)."

    Here's a hint as to how long ago this change happened.

    Glibc 2 HOWTO
      Eric Green, ejg3@cornell.edu
      v1.6, 22 June 1998
    
    0 讨论(0)
  • 2021-02-01 19:02

    You will find this article of interest. There is something called PAM (Password Authentication Module) which runs your password through a series of modules (configured in /etc/pam.d/passwd or /etc/pam.conf) to determine whether the password is valid or not.

    0 讨论(0)
  • 2021-02-01 19:03

    Although the original DES-based algorithm only used the first 8 characters of the password, Linux, Solaris, and other newer systems now additionally support other password hash algorithms such as MD5 which do not have this limit. Sometimes it is necessary to continue using the old algorithm if your network contains older systems and if NIS is used. You can tell that the old DES-based algorithm is still being used if the system will log you in when you enter only the first 8 characters of your >8-character password.

    Because it is a hash algorithm, MD5 does not have an intrinsic limit. However various interfaces do generally impose some limit of at least 72 characters.

    Although originally the encrypted password was stored in a world-readable file (/etc/passwd), it is now usually stored in a separate shadow database (e.g. /etc/shadow) which is only readable by root. Therefore, the strength of the algorithm is no longer as important as it once was. However if MD5 is inadequate, Blowfish or SHA can be used instead on some systems. And Solaris supports pluggable password encryption modules, allowing you to use any crazy scheme. Of course if you are using LDAP or some other shared user database then you will need to select an algorithm that is supported on all of your systems.

    0 讨论(0)
  • 2021-02-01 19:06

    I think around the time when actual passwords were moved from /etc/passwd to shadow, on Linux . I am guessing around 2000, Red Hat 6.x had long passwords IIRC. Around 2000 there were still a lot of old SUN, and they had password and username limits.

    0 讨论(0)
  • 2021-02-01 19:07

    Not for Linux. It's only 8 if you disable MD5 Hashing.

    http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/security-guide/s1-wstation-pass.html

    You can administer policies enforcing longer and more complex passwords as well.

    The full lengths are discussed here:

    http://www.ratliff.net/blog/2007/09/20/password-length/

    0 讨论(0)
提交回复
热议问题