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
이것은 다음의 출력입니다 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
출력 [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
:
<my_name>\USER
답변1
아직 SSH 서버에 대한 비밀번호를 설정하지 않았습니다. 서버의 기본 비밀번호는 무엇입니까?
하나도 없습니다.
서버에 로그인하려고 할 때마다 비밀번호를 묻는 메시지가 나타납니다. 저는 Windows 10 PC에 비밀번호를 하나만 구성했는데, 이것이 바로 제 Microsoft 계정의 비밀번호입니다. 그러나 서버는 해당 비밀번호로 접근을 거부합니다.
잘못된 사용자 이름으로 연결을 시도하고 있습니다. ssh Machine_Name\Username@localhost
서버에 연결하려면 사용해야 합니다 .
왜 \USER 부분을 제공해야 합니까?
OpenSSH 서버에 연결하려면 사용하려는 사용자 이름을 명시적으로 지정해야 합니다. 또한 ssh <my_name>@localhost
사용자 이름이 실제 사용자 이름이 아닌 컴퓨터 이름임을 나타내는 구문을 사용했다고 표시했습니다 .
부터<my_name>
은(는) 컴퓨터의 실제 사용자 이름이 아닙니다. 비밀번호 인증에 실패했습니다. 실제로 사용해야 합니다.Username
그리고 그것이 컴퓨터에 있다는 것을 명시적으로 나타냅니다.Machine_Name\Username
.
의 출력은 [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
무엇을 사용해야 하는지를 나타냅니다.
답변2
유효한 사용자 이름과 비밀번호를 허용하지 않는 또 다른 이유는 구성된 셸이 잘못된 경우입니다.
어떤 것인지 확인할 수 있습니다
reg query HKLM\SOFTWARE\OpenSSH /v DefaultShell
기본 디렉터리에 Powershell이 있는 경우 이를 Powershell로 설정하려면 다음을 수행하세요.
reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
답변3
whoami
cmd에 작성 하면 텍스트가 제공되고 전체 텍스트를 복사합니다. 전체는 전체를 의미합니다. 이 예에서는 내가nick\hp
출력을 얻었다고 가정해 보겠습니다 .이제 cmd에 를 입력
ssh nick\hp@localhost
하고 Enter를 누르세요.비밀번호를 묻는 메시지가 나타나면 여기에 Microsoft 계정의 비밀번호를 입력하세요. 그리고 당신은 성공적으로 SSH에 접속할 것입니다.
답변4
비슷한 문제가있었습니다. ssh 로그인은 어느 날까지 정상적으로 작동했습니다. 정확히 무슨 일이 일어났는지 잘 모르겠습니다. 삼바를 통해 Windows 폴더를 공유하려고 시도하여 일부 openssh 설정을 망쳤을 수도 있습니다. 어쨌든 해결책은 다음과 같습니다.
새로운 Windows 사용자 생성
그게 다야. 새 계정으로 정상적으로 로그인할 수 있습니다. 내가 아무것도 하지 않은 채 이전 계정의 SSH 비밀번호가 변경된 것 같습니다.