OpenSSH não aceita minha senha de login

OpenSSH não aceita minha senha de login

Configurei com êxito o servidor e o cliente OpenSSH em execução na seção de recursos opcionais do Windows 10.
Sempre que tento fazer login no servidor, é solicitada uma senha. Configurei apenas uma única senha para meu PC com Windows 10, que é a senha da minha conta da Microsoft. Porém, o servidor nega acesso com essa senha. Ainda não configurei nenhuma senha para o servidor SSH.
Qual é a senha padrão do servidor?

Aqui está o conteúdo do sshd_configarquivo na %PROGRAMDATA%\ssh\pasta:

# 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

Esta é a saída de 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

Saída de [System.Security.Principal.WindowsIdentity]::GetCurrent().Name:

<my_name>\USER

Responder1

Ainda não configurei nenhuma senha para o servidor SSH. Qual é a senha padrão do servidor?

Não há um.

Sempre que tento fazer login no servidor, é solicitada uma senha. Configurei apenas uma única senha para meu PC com Windows 10, que é a senha da minha conta da Microsoft. Porém, o servidor nega acesso com essa senha.

Você está tentando se conectar com o nome de usuário incorreto. Você deve usar ssh Machine_Name\Username@localhostpara se conectar ao servidor.

Por que preciso fornecer a parte \USER?

Você deve indicar explicitamente qual nome de usuário deseja usar para se conectar ao servidor OpenSSH. Você também indicou que usou a sintaxe, ssh <my_name>@localhostque indica que o nome de usuário era o nome da sua máquina em vez do seu nome de usuário real.

Desde<my_name>não é um nome de usuário real na máquina, a autenticação da senha estava falhando, você realmente precisa usarUsernamee indicar explicitamente que está na máquinaMachine_Name\Username.

A saída de [System.Security.Principal.WindowsIdentity]::GetCurrent().Nameindicará o que deve ser usado.

Responder2

Outra razão pela qual ele pode não aceitar um nome de usuário e senha válidos é se o shell configurado estiver errado.

Você pode verificar com o que está

reg query HKLM\SOFTWARE\OpenSSH /v DefaultShell

Para configurá-lo para Powershell, se você o tiver no diretório padrão:

reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe

Responder3

  1. Escreva whoamino cmd, vai te dar um texto, copie o texto inteiro, por inteiro quero dizer o todo. Para este exemplo, digamos que recebi nick\hpcomo saída.

  2. Agora em cmd, digite ssh nick\hp@localhoste pressione Enter.

  3. Vai pedir uma senha, digite aqui a senha da sua conta Microsoft. E você fará o ssh com sucesso.

Responder4

Eu tive uma questão semelhante. O login ssh estava funcionando normalmente até um dia. Não tenho certeza do que exatamente aconteceu. Eu poderia ter tentado compartilhar uma pasta do Windows via samba e, assim, estragar algumas configurações do openssh. De qualquer forma aqui está a solução:

Crie um novo usuário do Windows

É isso. Consigo fazer login normalmente com a nova conta. Parece que a senha ssh da conta antiga mudou sem que eu fizesse nada.

informação relacionada