WSL: service ssh start failed!

username@host:~$ sudo apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  ssh-askpass rssh molly-guard monkeysphere
The following NEW packages will be installed:
  openssh-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 322 kB of archives.
After this operation, 955 kB of additional disk space will be used.
Get:1 http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates/main openssh-server amd64 1:6.6p1-2ubuntu2.7 [322 kB]
Fetched 322 kB in 0s (625 kB/s)
Preconfiguring packages ...
Selecting previously unselected package openssh-server.
(Reading database ... 25409 files and directories currently installed.)
Preparing to unpack .../openssh-server_1%3a6.6p1-2ubuntu2.7_amd64.deb ...
Unpacking openssh-server (1:6.6p1-2ubuntu2.7) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up openssh-server (1:6.6p1-2ubuntu2.7) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
runlevel:/var/run/utmp: No such file or directory
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
zonek@XEON-DESKTOP:~$ sudo service ssh start
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
 * Starting OpenBSD Secure Shell server sshd                                                                     [ OK ]
username@host:~$ sudo service ssh status
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
 * sshd is not running
username@host:~$

Who can tell me how to start ssh server? Think you!

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

There is a good thread on running sshd over at #300.

The punchline of the thread is:

install with sudo apt-get install openssh-server Modify the /etc/ssh/sshd_config file with:

ListenAddress 0.0.0.0
UsePrivilegeSeparation no
PasswordAuthentication yes

At that point you can sudo service ssh start.

russ@DESKTOP-K1JHN54:/etc/ssh$ sudo service ssh start initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

  • Starting OpenBSD Secure Shell server sshd

You can ignore the upstart error in this case. After that you can SSH into the box:

russ@DESKTOP-K1JHN54:/etc/ssh$ ssh russ@localhost russ@localhost’s password:

@aseering I think it might be set as default to launch SSH service when your user account is a DevToolUser (not quite sure) or maybe just because some MS build-in tools or apps use it. You could see them in your task manager if they are running: image I don’t want to change my port for WSL so I turn these two MS services into “Disabled” in Service: image then you could use SSH in your WSL without changing the port.

In my case the Windows Service (SSH Server Proxy) was using SSH port 22 on my computer. I had to switch my OpenSSH server port to something else for it to startup. I also had to use the settings recommended by @russalex as well.

i check list of services and i see this

“SSH server proxy” “SSH server broker”

in description “Part of Microsoft SSH Server for Windows”

it’s part of BashOnWindows? do i need it? i disable it

and now service ssh from bash work problem solved