Eu poderia finalmente resolver isso.
As chaves não foram geradas na pasta relevante.
Se você seguir as estas instruções , será necessário alterar o diretório para a pasta relevante antes aplicando o passo # 3.
Eu tento instalar o este pacote OpenSSH no Windows Server 2008 R2. Eu apliquei todos os passos (exceto o firewall) e todos passaram com sucesso.
Quando eu tento este comando
net start sshd
Eu recebo este erro:
The SSHD service is starting. The SSHD service could not be started.
A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.
Qual poderia ser o problema? Não consegui encontrar nenhum arquivo de log. A segurança no Visualizador de Eventos do Windows diz apenas:
The SSHD service terminated unexpectedly. It has done this 2 time(s).
Ao executar no modo de depuração, recebo isso:
-
debug2: load_server_config: filename C:\Users\Administrator\Downloads\OpenSSH-Win32\OpenSSH-Win32/sshd_config
debug2: parse_server_config: config C:\Users\Administrator\Downloads\OpenSSH-Win32\OpenSSH-Win32/sshd_config len 256
debug3: C:\Users\Administrator\Downloads\OpenSSH-Win32\OpenSSH-Win32/sshd_config:50 setting AuthorizedKeysFile .ssh/authorized_keys
debug3: C:\Users\Administrator\Downloads\OpenSSH-Win32\OpenSSH-Win32/sshd_config:115 setting Subsystem sftp /usr/libexec/sftp-server
debug3: C:\Users\Administrator\Downloads\OpenSSH-Win32\OpenSSH-Win32/sshd_config:123 setting PubkeyAcceptedKeyTypes +ssh-dss,ecdsa-sha2-nistp256
debug1: sshd version OpenSSH_7.1, OpenSSL 1.0.2d 9 Jul 2015
[Build Nov 9 2015 22:18:33]
debug3: getpwnam: username [sshd]
debug3: getpwnam: system dir [C:\Windows\system32]
debug3: getpwnam: shell path [C:\Windows\system32\cmd.exe]
debug1: _open() returned error, errno [2]
debug1: key_load_private: No such file or directory
debug1: _open() returned error, errno [2]
debug1: key_load_public: No such file or directory
Could not load host key: ssh_host_rsa_key
debug1: _open() returned error, errno [2]
debug1: key_load_private: No such file or directory
debug1: _open() returned error, errno [2]
debug1: key_load_public: No such file or directory
Could not load host key: ssh_host_dsa_key
debug1: _open() returned error, errno [2]
debug1: key_load_private: No such file or directory
debug1: _open() returned error, errno [2]
debug1: key_load_public: No such file or directory
Could not load host key: ssh_host_ecdsa_key
debug1: _open() returned error, errno [2]
debug1: key_load_private: No such file or directory
debug1: _open() returned error, errno [2]
debug1: key_load_public: No such file or directory
Could not load host key: ssh_host_ed25519_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.
-
Você pode ver mais detalhes sobre o XML abaixo.
Nota:
C:\Users\Administrator\.ssh
: id_rsa e id_rsa.pub - veja a saída abaixo) Estes são os detalhes XML do Visualizador de Eventos:
Log Name: System
Source: Service Control Manager
Date: 12/25/2015 12:17:53 PM
Event ID: 7034
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: WINSXXX
Description:
The SSHD service terminated unexpectedly. It has done this 2 time(s).
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Service Control Manager" Guid="{555908d1-a6d7-4695-8e1e-26931d2012f4}" EventSourceName="Service Control Manager" />
<EventID Qualifiers="49152">7034</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8080000000000000</Keywords>
<TimeCreated SystemTime="2015-12-25T10:17:53.073482000Z" />
<EventRecordID>20007</EventRecordID>
<Correlation />
<Execution ProcessID="468" ThreadID="4180" />
<Channel>System</Channel>
<Computer>WINSXXX</Computer>
<Security />
</System>
<EventData>
<Data Name="param1">SSHD</Data>
<Data Name="param2">2</Data>
</EventData>
</Event>
Saída de chaves geradoras:
C:\Users\Administrator>C:\Users\Administrator\Downloads\OpenSSH-Win32\OpenSSH-Win32\ssh-keygen.exe
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Administrator/.ssh/id_rsa):
C:\Users\Administrator/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Administrator/.ssh/id_rsa.
Your public key has been saved in C:\Users\Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:POHEtRE0YZGfFqcxjkt8x9znhJsm+MvCuhFCUR9bYxg Administrator@WINSXXX
The key's randomart image is:
+---[RSA 2048]----+
| ....EB+ |
| o +oO+.. |
| . +.++ X o |
| . + .+ B = +|
| . S. = . =.|
| . oo . + .|
| .. . o |
| .o.. |
| oo .o. |
+----[SHA256]-----+
C: \ Users \ Administrator >
Eu poderia finalmente resolver isso.
As chaves não foram geradas na pasta relevante.
Se você seguir as estas instruções , será necessário alterar o diretório para a pasta relevante antes aplicando o passo # 3.
Consegui iniciar o serviço sshd depois de seguir as etapas 5 e 6 em as instruções
Setup SSH host keys (this will generate all the 'host' keys that sshd expects when its starts)
- .\ssh-keygen.exe -A
Secure SSH host keys (optional)
- Start-Service ssh-agent
- download psexec from here
- launch cmd.exe as SYSTEM - psexec.exe -i -s cmd.exe
- register host keys in above cmd.exe
- ssh-add ssh_host_dsa_key
- ssh-add ssh_host_rsa_key
- ssh-add ssh_host_ecdsa_key
- ssh-add ssh_host_ed25519_key