I have been spending the last 4 hours trying to get my VNC connection to work. Eventually, I realized it was because my Ubuntu remote host was unable to host SSH connections- even though I had already installed openssh-server.

I then tried some basic tests to verify that sshd was working on my machine, and found that ssh localhost gives a Connection refused on port 22 error. Also, sudo service ssh start and sudo start ssh both give a start: Unknown job: ssh error. I tried purging and reinstalling openssh-server, but no luck. Why can't I receive clients?

EDIT: When I try to connect via the local machines (the VNC viewers) they give me a Connection timed out error.

EDIT_2: As requested, here is the output of apt-cache policy openssh-server:

  Installed: 1:6.6p1-2ubuntu2
  Candidate: 1:6.6p1-2ubuntu2
  Version table:
 *** 1:6.6p1-2ubuntu2 0
        500 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main armhf Packages
        100 /var/lib/dpkg/status
     1:6.6p1-2ubuntu1 0
        500 http://ports.ubuntu.com/ubuntu-ports/ trusty/main armhf Packages
  • Do you have set up a firewall? maybe the server firewall (iptables?) is blocking the connection at port 22. – Registered User Jun 23 '15 at 6:26
  • @RegisteredUser I just did an install of ufw (uncomplicated firewall) and it says the status is inactive, so I don't think I have one. – James Ko Jun 23 '15 at 6:34
  • Have a look at sudo iptables --list – Registered User Jun 23 '15 at 6:38
  • @RegisteredUser I have no idea what they mean, but here is what I found. – James Ko Jun 23 '15 at 6:45
  • Edit your question and add the output of apt-cache policy openssh-server – A.B. Jun 23 '15 at 6:47

Just do

sudo ufw enable


sudo apt-get install gufw

Then open your Dash and search for "Firewall". Open it and the rest should be self explaining.

  • I seem to have gotten an error when running sudo ufw enable. – James Ko Jun 23 '15 at 7:20
  • @JamesKo Well maybe purging and reinstalling will help. – Marton Jun 23 '15 at 7:25
  • Have you read this? "sudo service ssh start and sudo start ssh both give a start: Unknown job: ssh error" – A.B. Jun 23 '15 at 8:33

I managed to get this working by manually starting sshd:

sudo mkdir /var/run/sshd
sudo chmod -R 755 /var/run/sshd
sudo /usr/sbin/sshd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.