ssh 服务器配置 - input_userauth_request:无效用户

Phi*_*ipp 7 ssh ssh-agent

我在配置 SSH 服务器时遇到问题,无法使用公钥登录,无需密码。

tail -f /var/log/auth.log 给出

Feb  6 14:56:06 ubuntu sshd[24654]: rexec line 26: Deprecated option RhostsAuthentication
Feb  6 14:56:28 ubuntu sshd[24654]: Invalid user mpsd from ip.ip.ip.ip
Feb  6 14:56:28 ubuntu sshd[24654]: input_userauth_request: invalid user mpsd [preauth]
Feb  6 14:56:28 ubuntu sshd[24654]: error: Received disconnect from ip.ip.ip.ip: 14: No supported authentication methods available [preauth]
Run Code Online (Sandbox Code Playgroud)

我已经检查过 /home/mpsd/.ssh 有 700 和 /home/mpsd/.ssh/authorized_keys 有 600 权限。authorized_keys 包含在我的远程 Windows 机器上生成的 rsa 公钥。我的 sshd_config 读取

Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2

HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key

UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile ~/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
RhostsRSAAuthentication no
RhostsAuthentication no
HostbasedAuthentication no
IgnoreUserKnownHosts yes

PermitEmptyPasswords yes
ChallengeResponseAuthentication no
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

#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 no
Run Code Online (Sandbox Code Playgroud)

我不知道为什么消息说无效用户,因为它显然存在。谢谢你的帮助。

Mic*_*ton 3

目前您的 sshd 配置没有启用身份验证方法,因此 sshd 无法对用户进行身份验证。

默认情况下,sshd 使用本地 PAM 设置来验证用户身份。但是,管理您系统的 ssmeone 将默认值更改UsePAM yesUsePAM no. 只需恢复此更改即可。