![Ubuntu 16 Sudo SU 잘못된 비밀번호 시도](https://linux55.com/image/134406/Ubuntu%2016%20Sudo%20SU%20%EC%9E%98%EB%AA%BB%EB%90%9C%20%EB%B9%84%EB%B0%80%EB%B2%88%ED%98%B8%20%EC%8B%9C%EB%8F%84.png)
Ubuntu 16.04.3 LTS 서버를 사용하고 있습니다. sudo 권한을 가진 사용자가 있습니다. 현재 사용자에서 루트로 전환하려고 하면 비밀번호를 묻는 메시지가 나타납니다. 올바른 비밀번호를 입력했지만 비밀번호가 거부되었습니다.
username@server:/ sudo su
[sudo] password for username:
Sorry, try again.
[sudo] password for username:
Sorry, try again.
[sudo] password for username:
sudo: 3 incorrect password attempts
다행히 다른 터미널 창을 열었는데 여전히 루트로 로그인되어 있습니다. 그래서 사용자의 비밀번호를 재설정하려고 합니다. 사용자를 성공적으로 업데이트했다고 합니다.
root@server:/# passwd username
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
그래서 나는 그 명령을 다시 시도했다 sudo su
. 같은 메시지와 함께 실패합니다.
동일한 사용자에 대해 새 터미널 창을 열고 시도했지만 sudo su
동일한 메시지와 함께 동일한 명령이 실패했습니다.
나는 또한 사용자의 잠금을 해제하려고 시도했습니다 sudo usermod --expiredate -1 username
. 이것도 문제가 해결되지 않았습니다.
또한 사용자에게 "sudo" 권한을 부여해 보았습니다 usermod -aG sudo username
. 사용자에게 여전히 이 문제가 발생하고 있습니다.
포기하고 방금 sudo 권한을 가진 새 사용자를 만들고 새 사용자를 사용하기 시작했습니다. 다음날 나는 새로운 사용자와 똑같은 문제를 겪기 시작했습니다.
이 pwck
명령은 여러 시스템 계정과 해당 홈 디렉터리에 대한 메시지를 나열하지만 그 외에는 아무것도 나열하지 않습니다. 이 grpck
명령은 전혀 메시지를 제공하지 않습니다.
최근 약 한 달 전에 "pam" 인증을 추가했습니다.
/etc/pam.d/sudo
#%PAM-1.0
session required pam_env.so readenv=1 user_readenv=0
session required pam_env.so readenv=1 envfile=/etc/default/locale user_readenv=0
@include common-auth
@include common-account
@include common-session-noninteractive
/etc/pam.d/common-auth
auth required pam_tally2.so deny=5 unlock_time=600
# here are the per-package modules (the "Primary" block)
auth [success=1 default=ignore] pam_unix.so nullok_secure
# here's the fallback if no module succeeds
auth requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
auth required pam_permit.so
# and here are more per-package modules (the "Additional" block)
auth optional pam_cap.so
# end of pam-auth-update config
/etc/pam.d/common-account
# here are the per-package modules (the "Primary" block)
account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so
# here's the fallback if no module succeeds
account requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
account required pam_permit.so
# and here are more per-package modules (the "Additional" block)
# end of pam-auth-update config
/etc/pam.d/common-session-noninteractive
# here are the per-package modules (the "Primary" block)
session [default=1] pam_permit.so
# here's the fallback if no module succeeds
session requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
session required pam_permit.so
# The pam_umask module will set the umask according to the system default in
# /etc/login.defs and user settings, solving the problem of different
# umask settings with different shells, display managers, remote sessions etc.
# See "man pam_umask".
session optional pam_umask.so
# and here are more per-package modules (the "Additional" block)
session required pam_unix.so
# end of pam-auth-update config
@telcoM님, @roaima님 덕분에 pam 인증 모듈이 문제의 원인이라는 것을 알게 되었습니다.
root@server:/# pam_tally2
Login Failures Latest failure From
username 53 06/05/18 16:53:42 xxx.xxx.xxx.xxx
문제의 원인을 찾았지만 이 동작을 이해할 수 없습니다. 아마도 pam 모듈에서 잘못 구성했을 수도 있습니다. 입력할 때마다 sudo su
(성공 여부에 관계없이) 실패가 pam_tally2
. 아래 예.
pam_tally2
Login Failures Latest failure From
username 0 06/05/18 16:53:42 xxx.xxx.xxx.xxx
username@server:/ sudo su
[sudo] password for username:
root@server:/#
pam_tally2
Login Failures Latest failure From
username 1 06/05/18 16:54:03 xxx.xxx.xxx.xxx
사용하면 오작동이 증가 할 sudo -s
수도 있습니다 .sudo -i
pam_tally2
답변1
승인되지 않은 외부 사용자가 계속 로그인을 시도한다고 말씀하셨습니다. 원치 않는 원격 로그인 시도가 root
사용자 계정을 참조하는 경우 PAM 모듈이 둘 중 하나 또는 둘 다를 잠그고 있음 username
을 의미할 수 있습니다 .pam_tally2
명령을 실행하여 pam_tally2
실패의 원인을 확인하십시오. ( pam_tally2 --user=username --reset
재설정하려면 실행해야 할 수도 있습니다 username
.
또는 이 문제 보고서/etc/ssh/sshd_config 파일에 "ChallengeResponseAuthentication yes"가 설정된 경우 pam_tally2는 올바른 비밀번호를 실패한 로그인 시도로 계산합니다.상황을 더 정확하게 설명할 수 있습니다. (나는 아직도 해결책을 위한 대체 소스를 찾으려고 노력하고 있습니다.)
그건 그렇고, Canonical의 모든 최선의 (그리고 잘못된) 노력에도 불구하고 그것을 어떤 용도로든 사용할 필요는 없습니다 sudo su
. (이것은 "라고 말하는 것과 같습니다.루트를 알려주세요? 알았어 고마워. 이제 나는 루트입니다. 루트가 되어야 합니다.".) sudo -s
루트 쉘이나 sudo -i
루트 로그인 쉘을 사용해 보십시오.