OpenSSH 不接受我的登录密码

Pus*_*pam 9 ssh openssh windows-10

我已经成功设置了通过 Windows 10 可选功能部分运行的 OpenSSH 服务器和客户端。
每当我尝试登录服务器时,系统都会要求我输入密码。我只为我的 Windows 10 PC 配置了一个密码,即我的 Microsoft 帐户的密码。但是,服务器拒绝使用该密码进行访问。我还没有为 SSH 服务器设置任何密码。
服务器的默认密码是什么?

sshd_config以下是文件夹中文件的内容%PROGRAMDATA%\ssh\

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey __PROGRAMDATA__/ssh/ssh_host_rsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_dsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_ecdsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile  .ssh/authorized_keys

#AuthorizedPrincipalsFile none

# For this to work you will also need host keys in %programData%/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem   sftp    sftp-server.exe

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server
Run Code Online (Sandbox Code Playgroud)

这是以下的输出Get-NetFirewallRule -Name *ssh*

Name                  : OpenSSH-Server-In-TCP
DisplayName           : OpenSSH SSH Server (sshd)
Description           : Inbound rule for OpenSSH SSH Server (sshd)
DisplayGroup          : OpenSSH Server
Group                 : OpenSSH Server
Enabled               : True
Profile               : Any
Platform              : {}
Direction             : Inbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 :
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : SshProxy-Service
DisplayName           : SshProxy-Service-Private
Description           : SSH Server Proxy Service
DisplayGroup          : Ssh Server
Group                 : Ssh Server
Enabled               : True
Profile               : Private
Platform              : {}
Direction             : Inbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 :
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local

Name                  : SshProxy-Service-Domain
DisplayName           : SshProxy-Service-Domain
Description           : SSH Server Proxy Service
DisplayGroup          : Ssh Server
Group                 : Ssh Server
Enabled               : True
Profile               : Domain
Platform              : {}
Direction             : Inbound
Action                : Allow
EdgeTraversalPolicy   : Block
LooseSourceMapping    : False
LocalOnlyMapping      : False
Owner                 :
PrimaryStatus         : OK
Status                : The rule was parsed successfully from the store. (65536)
EnforcementStatus     : NotApplicable
PolicyStoreSource     : PersistentStore
PolicyStoreSourceType : Local
Run Code Online (Sandbox Code Playgroud)

输出[System.Security.Principal.WindowsIdentity]::GetCurrent().Name

<my_name>\USER
Run Code Online (Sandbox Code Playgroud)

Ram*_*und 7

我还没有为 SSH 服务器设置任何密码。服务器的默认密码是什么?

没有一个。

每当我尝试登录服务器时,系统都会要求我输入密码。我只为我的 Windows 10 PC 配置了一个密码,即我的 Microsoft 帐户的密码。但是,服务器拒绝使用该密码进行访问。

您尝试使用不正确的用户名进行连接。您应该使用它ssh Machine_Name\Username@localhost来连接到服务器。

为什么我需要给出 \USER 部分?

您必须明确指出要使用哪个用户名才能连接到 OpenSSH 服务器。您还表明您使用了语法 ,ssh <my_name>@localhost这表明用户名是您的计算机的名称而不是您的实际用户名。

由于<my_name>不是计算机上的实际用户名,因此密码身份验证失败,您实际上必须使用Username并明确指示它在计算机上Machine_Name\Username

will的输出[System.Security.Principal.WindowsIdentity]::GetCurrent().Name表明应该使用什么。


miv*_*ivk 5

它可能不接受有效用户名和密码的另一个原因是配置的 shell 错误。

你可以检查它是与哪个

reg query HKLM\SOFTWARE\OpenSSH /v DefaultShell
Run Code Online (Sandbox Code Playgroud)

要将其设置为 Powershell(如果默认目录中有它):

reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
Run Code Online (Sandbox Code Playgroud)