PAM 비밀번호 'minlen' 설정이 적용되지 않음

PAM 비밀번호 'minlen' 설정이 적용되지 않음

Ubuntu 18.04를 설치하고 /etc/security/pwquality.conf다음 설정을 수동으로 수정했습니다.

minlen = 14
minclass = 4 

( #줄의 시작 부분이 아닙니다.)

그러나 새 사용자를 추가하고 새 비밀번호 프롬프트에 "123"을 입력하면 다음 메시지가 표시됩니다.

잘못된 비밀번호: 비밀번호가 14자 미만입니다.
새 비밀번호를 다시 입력하세요.

문제는 "123"을 다시 입력하면 다음과 같이 표시된다는 것입니다.

비밀번호가 사용되었습니다.

passwd: 비밀번호가 성공적으로 업데이트되었습니다.

따라서 새 비밀번호를 "123"으로 설정하고 해당 minlen설정을 무시할 수 있습니다.

설정이 무시되는 이유는 무엇입니까?

편집하다:

/etc/security/pwquality.conf를 편집했습니다:

# Configuration for systemwide password quality limits
# Defaults:
#
# Number of characters in the new password that must not be present in the
# old password.
# difok = 1
#
# Minimum acceptable size for the new password (plus one if
# credits are not disabled which is the default). (See pam_cracklib manual.)
# Cannot be set to lower value than 6.
minlen = 14
#
# The maximum credit for having digits in the new password. If less than 0
# it is the minimum number of digits in the new password.
# dcredit = 0
#
# The maximum credit for having uppercase characters in the new password.
# If less than 0 it is the minimum number of uppercase characters in the new
# password.
# ucredit = 0
#
# The maximum credit for having lowercase characters in the new password.
# If less than 0 it is the minimum number of lowercase characters in the new
# password.
# lcredit = 0
#
# The maximum credit for having other characters in the new password.
# If less than 0 it is the minimum number of other characters in the new
# password.
# ocredit = 0
#
# The minimum number of required classes of characters for the new
# password (digits, uppercase, lowercase, others).
minclass = 4
#
# The maximum number of allowed consecutive same characters in the new password.
# The check is disabled if the value is 0.
# maxrepeat = 0
#
# The maximum number of allowed consecutive characters of the same class in the
# new password.
# The check is disabled if the value is 0.
# maxclassrepeat = 0
#
# Whether to check for the words from the passwd entry GECOS string of the user.
# The check is enabled if the value is not 0.
# gecoscheck = 0
#
# Whether to check for the words from the cracklib dictionary.
# The check is enabled if the value is not 0.
# dictcheck = 1
#
# Whether to check if it contains the user name in some form.
# The check is enabled if the value is not 0.
# usercheck = 1
#
# Whether the check is enforced by the PAM module and possibly other
# applications.
# The new password is rejected if it fails the check and the value is not 0.
enforcing = 1
#
# Path to the cracklib dictionaries. Default is to use the cracklib default.
# dictpath =
enforce_for_root

(enforcing_for_root 행을 추가하고 enforcing=1 행의 주석 처리를 제거해 보십시오). 여전히 같은 문제가 있습니다

답변1

루트 쉘에 있고 사용자를 생성한 후 비밀번호를 설정한 경우 /etc/security/pwquality.conf설정을 적용하려면 하단 근처에 있는 줄의 주석 처리를 제거해야 합니다.

enforce_for_root

주석 처리하면 이러한 설정은 일반 사용자에게만 적용됩니다. 이것이 없어도 해당 사용자로 비밀번호를 변경하려고 하면 비밀번호가 14자 미만이고 다른 요구 사항이 충족되지 않는다는 메시지와 함께 실패합니다. 귀하의 경우에는 위 줄의 주석 처리를 제거하십시오.

관련 정보