SSH 비밀번호 확인을 비활성화하면 Debian VPS에서 작동하지 않습니다

SSH 비밀번호 확인을 비활성화하면 Debian VPS에서 작동하지 않습니다

Debian 7 VPS 설정이 있습니다. 방금 SSH 키 인증을 활성화하고 비밀번호 인증을 비활성화했는데 비활성화가 작동하지 않습니다.

SSH를 통해 VPS에 연결하려고 하면 SSH 키 비밀번호를 묻는 메시지가 표시되고 제대로 작동하지만 취소를 클릭하면 "에이전트가 서명 실패를 확인했습니다." 오류가 표시되고 현재 사용자 계정 비밀번호를 묻는 메시지가 표시됩니다. , 비활성화했는데도 입력하고 계정 비밀번호를 사용하여 로그인합니다. 왜 비밀번호 액세스로 로그인할 수 있는지 아시는 분 있나요? 감사해요

4096비트 키를 사용하여 연결하고 있습니다.

이것은 내 sshd_config입니다.

Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

답변1

방금 비활성화했습니다 ChallengeResponseAuthentication. 로 시작하는 줄 # 은 주석이며 구성으로 해석되지 않으며 사람이 쉽게 읽을 수 있도록 만들어졌습니다.

비밀번호로 로그인할 수 있는 모든 가능성을 비활성화하려면 다음을 설정해야 합니다.

PasswordAuthentication no

그리고

ChallengeResponseAuthentication no

pam_unix비밀번호를 사용하여 로그인할 수 있는 경로가 있습니다 . 이 기능은 나중에 비활성화됩니다.

답변2

/etc/ssh/sshd_config파일에 지시문이 있는지 다시 확인해야 합니다 Include. 그렇다면 포함된 파일을 따라 PasswordAuthentication설정이 올바른지 확인하세요.

내 경우: Fedora33, 내 sshd_config파일은 다음과 같습니다.

Include /etc/ssh/sshd_config.d/*.conf

...
PasswordAuthentication no
...

그러나 파일:은 /etc/ssh/sshd_config.d/50-redhat.confPasswordAuthentication옵션을 무시합니다. PasswordAuthentication=no변경 후에는 /etc/ssh/sshd_config.d/50-redhat.conf모든 것이 예상대로 작동합니다.

답변3

아래와 같이 비밀번호 프롬프트 수를 0으로 설정할 수 있습니다.

-oNumberOfPasswordPrompts=0

폴리스티렌

이것이 문제와 관련이 없더라도 다음이 유용할 수 있습니다(특히 임의 IP에 연결하려는 경우).

-oStrictHostKeychecking=no

키 확인을 건너뜁니다.알려진 키대상 컴퓨터의 파일.

특정 사용자 계정에 대한 비밀번호 없는 액세스를 확인하기 위해 다음 명령을 사용하고 있습니다.

ssh -oStrictHostKeychecking=no -oNumberOfPasswordPrompts=0 <user>@<ip> exit

답변4

이 옵션은 BatchMode=yes비밀번호 인증을 비활성화한 경우에도 작동합니다.

[oracle@host OHOME1020 /tools/oracle]$ ssh remotehost
oracle@remotehost's password:  [[ <Ctrl-C> pressed... ]]

[oracle@host OHOME1020 /tools/oracle]$ ssh -o BatchMode=yes remotehost
Permission denied (publickey,password).
[oracle@host OHOME1020 /tools/oracle]$  [[ prompt returned promptly ]]

관련 정보