Skip to content

Commit 2cd4906

Browse files
authored
openssh-server host keys are missing /etc/ssh
Host keys are missing under /etc/ssh it had to purge&install openssh-server to have keys generated and available Seems like its a bug. I suggest to further investigate it.
1 parent 7c24b93 commit 2cd4906

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

WSL/troubleshooting.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,38 @@ You can confirm that the Windows Subsystem for Linux is enabled by running the f
156156
PowerShell
157157
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
158158
```
159+
160+
### OpenSSH-Server connection issues
161+
Trying to connect your SSH server is failed with the following error: "Connection closed by 127.0.0.1 port 22".
162+
1. Make sure your OpenSSH Server is running:
163+
``` BASH
164+
sudo service ssh status
165+
```
166+
and you've followed this tutorial:
167+
https://help.ubuntu.com/lts/serverguide/openssh-server.html.en
168+
2. Stop the sshd service and start sshd in debug mode:
169+
``` BASH
170+
sudo service ssh stop
171+
sudo /usr/sbin/sshd -d
172+
```
173+
3. Check the startup logs and make sure HostKeys are available and you don't see log messages such as:
174+
debug1: sshd version OpenSSH_7.2, OpenSSL 1.0.2g 1 Mar 2016
175+
debug1: key_load_private: incorrect passphrase supplied to decrypt private key
176+
debug1: key_load_public: No such file or directory
177+
Could not load host key: /etc/ssh/ssh_host_rsa_key
178+
debug1: key_load_private: No such file or directory
179+
debug1: key_load_public: No such file or directory
180+
Could not load host key: /etc/ssh/ssh_host_dsa_key
181+
debug1: key_load_private: No such file or directory
182+
debug1: key_load_public: No such file or directory
183+
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
184+
debug1: key_load_private: No such file or directory
185+
debug1: key_load_public: No such file or directory
186+
Could not load host key: /etc/ssh/ssh_host_ed25519_key
187+
188+
If you do see such messages and the keys are missing under `/etc/ssh/`, you will have to regenerate the keys or just purge&install openssh-server:
189+
```BASH
190+
sudo apt-get purge openssh-server
191+
sudo apt-get install openssh-server
192+
```
193+

0 commit comments

Comments
 (0)