Why is my root password limited to 8 characters?

When I try to set root's password:

root@OpenWrt:~# passwd
Changing password for root
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.

It seems the maximum length is 8. If I try to set a password longer than 8, only first 8 characters is valid.
How can I set a longer password for root?

My openwrt version:

Linux OpenWrt 4.14.108 #0 SMP Wed Mar 27 21:59:03 2019 x86_64 GNU/Linux
type passwd
opkg search $(type -p passwd)
opkg list-installed shadow-\*
opkg files shadow-common
ls /etc/login.defs
4 Likes

This is certainly not a limitation of OpenWrt in general. I observe it neither on 18.06 or on 17.02 standard images, it must be with your specific OpenWrt build or your configuration.

@vgaetera already seems on the case to solve this, I don't want to sidetrack his efforts. But to avoid confusion or rumours regarding this rather touchy subject, I changed the thread title from "Why the maximum length of openwrt’s root password is 8?" to something that reflects that this is your specific problem, not OpenWrt's in general.

4 Likes
root@OpenWrt:~# type passwd
passwd is /usr/bin/passwd

root@OpenWrt:~# opkg list-installed shadow-\*
shadow-chage - 4.6-1
shadow-chfn - 4.6-1
shadow-chpasswd - 4.6-1
shadow-chsh - 4.6-1
shadow-common - 4.6-1
shadow-expiry - 4.6-1
shadow-faillog - 4.6-1
shadow-gpasswd - 4.6-1
shadow-groupadd - 4.6-1
shadow-groupdel - 4.6-1
shadow-groupmems - 4.6-1
shadow-groupmod - 4.6-1
shadow-groups - 4.6-1
shadow-lastlog - 4.6-1
shadow-login - 4.6-1
shadow-newgidmap - 4.6-1
shadow-newgrp - 4.6-1
shadow-newuidmap - 4.6-1
shadow-nologin - 4.6-1
shadow-passwd - 4.6-1
shadow-su - 4.6-1
shadow-useradd - 4.6-1
shadow-userdel - 4.6-1
shadow-usermod - 4.6-1
shadow-utils - 4.6-1
shadow-vipw - 4.6-1

root@OpenWrt:~# ls /etc/login.defs
/etc/login.defs

Thank you. I modified this in /etc/login.defs

PASS_MAX_LEN            8

problem fixed.

===========================

Important additions:

After I changed the above parameters, although I can set a password larger than 8 digits, it is still invalid because the real password is only the first eight digits. I don't know if this is my problem.

My final solution is to set

# ENCRYPT_METHOD DES

to

ENCRYPT_METHOD MD5

in /etc/login.defs .

Now, I can finally set a root password that is really larger than eight.

Thank you very much.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.