Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service ssh start failed! #734

Closed
daya-prac opened this issue Aug 3, 2016 · 15 comments
Closed

service ssh start failed! #734

daya-prac opened this issue Aug 3, 2016 · 15 comments

Comments

@daya-prac
Copy link

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!

@xukku
Copy link

xukku commented Aug 3, 2016

i have this error too

sudo service ssh start

initctl: Не удается подключиться к Upstart: Failed to connect to socket /com/ubuntu/upstart: В соединении отказано

  • Starting OpenBSD Secure Shell server sshd

sudo service ssh status

initctl: Не удается подключиться к Upstart: Failed to connect to socket /com/ubuntu/upstart: В соединении отказано

  • sshd is not running

@russalex
Copy link
Contributor

russalex commented Aug 3, 2016

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:

@xukku
Copy link

xukku commented Aug 3, 2016

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

@aseering
Copy link
Contributor

aseering commented Aug 3, 2016

@rivetweb -- for what it's worth, I'm not familiar with the "SSH server proxy" and "SSH server broker" services. I don't think I have either on my computer. Could they have been installed via some other means?

@xukku
Copy link

xukku commented Aug 4, 2016

@aseering

idk :) maybe it's Windows Terminal Server part maybe other.
just check your services list for other SSH servers and disable it if they exists
or change port in bash (in ubuntu ssh server)

@daya-prac
Copy link
Author

@russalex I have tried this, But it is not worked for me.
After Modified /etc/ssh/sshd_config:

username@host:~$ 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:~$ ps aux | grep ssh
username      186  0.0  0.0      0     0 ?        S     2432   0:00 grep --color=auto ssh
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

@russalex
Copy link
Contributor

russalex commented Aug 4, 2016

A couple of things to try at this point:

  1. I have experienced this behavior (the ssh service not starting) if port 22 is already bound. You can check this out by running netstat -a from a CMD prompt.

  2. You can try to uninstall and reinstall the Ubuntu OpenSSH server. Commands are:

sudo apt-get remove --purge openssh-server
sudo apt-get install openssh-server

Hope those help

@daya-prac
Copy link
Author

@russalex Thank you for your suggestion, I have tried this method, but it's still not worked.

@rustymulvaney
Copy link

rustymulvaney commented Aug 8, 2016

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.

@lwjason
Copy link

lwjason commented Aug 11, 2016

My computer also runs the SSH Server Broker and Proxy service automatically and occupies the port 22. I'm wondering why Windows start the SSH server automatically. First I don't need cmd CLI and second there are some security issues mentioned here: Windows 10 Insider: integrated SSH server. Does anyone know why it starts automatically?

@aseering
Copy link
Contributor

I'm really curious about this "SSH Server Broker" service -- it doesn't run by default on my computer; my computer doesn't even appear to have that service at all. Does anyone know where it comes from?

@lwjason
Copy link

lwjason commented Aug 11, 2016

@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.

@LessPaul
Copy link

Windows now has it's own SSH server as shown in the above posts. This ties up port 22. If you are having troubles, either disable the Windows server, or configure your linux SSH on an alternate port. There may be a way (I haven't investigated) to configure the Windows server to an alternate port.

@daya-prac
Copy link
Author

@LessPaul Thank you! Just this reason! I have changed the port to 2200, then it works!

@JefferyStark
Copy link

my case is it has no hotkeys, so just input
ssh-keygen -A
then try to start the service again, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants