After installing Bash on Windows and Ubuntu 18.04 LTS is SSHd not operational as the host keys are not created. There are three keys which are missing. While starting or stopping the service a message about each missing host key is shown.
To generate the missing keys run the following commands:
$ ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
$ ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
$ ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa -b 521
Login with a password into a SSH session fails as password authentication is disabled. You need to set PasswordAuthentication from no to yes in /etc/ssh/sshd_conf. This can be archived with sed:
$ sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
Aa last action restart sshd:
$ /etc/init.d/ssh restart