18

I have ssh and openconnect installed but when I proceed to start or stop the ssh service, I get the following error:

Failed to start ssh.service: Unit ssh.service not found.

Also, when I try sudo apt-get install ssh I get the following:

sudo apt-get install ssh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  ncurses-term openssh-server openssh-sftp-server ssh-import-id
Suggested packages:
  ssh-askpass rssh molly-guard monkeysphere
The following NEW packages will be installed:
  ncurses-term openssh-server openssh-sftp-server ssh ssh-import-id
0 upgraded, 5 newly installed, 0 to remove and 193 not upgraded.
Need to get 640 kB of archives.
After this operation, 5.237 kB of additional disk space will be used.
Do you want to continue? [Y/n]

Which I find confusing. If I do which ssh, I get:

/usr/bin/ssh

How can the binary be there if apt-get thinks the package is not installed?

Also, when calling ssh <valid-IP-address>, I get the following error:

ssh: connect to host port 22: No route to host

But if I use openconnect and connect to a VPN, ssh work without problems.

What am I missing? I'm running Ubuntu 16.04.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
borizzzzz
  • 311
  • 1
  • 2
  • 11

2 Answers2

19

The ssh binary, the SSH client, is provided by the openssh-client package, which is installed on your system.

The ssh service runs the SSH server, provided by the openssh-server package, which isn’t installed on your system.

The ssh package is a meta-package which installs both the client and the server.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • Just installed that `ssh` meta package in my buster just for trying it out. Is it recent? +1 – Rui F Ribeiro May 22 '19 at 07:28
  • 1
    It used to be the main binary package; it became a transitional package in 2004, and its description was changed in 2007 to identify it as a meta-package. – Stephen Kitt May 22 '19 at 07:33
  • Thanks! I have been using openssh-client and openssh-server directly for ages now. – Rui F Ribeiro May 22 '19 at 07:43
  • Thanks for your answer! What would explain me not being able to connect with ssh without the vpn connection, then..? – borizzzzz May 22 '19 at 07:50
  • 1
    @Kirjain that’s more likely to be network-related rather than contingent on the availability of the SSH service. I would guess you’re trying to connect to a host which isn’t reachable directly, but is reachable over your VPN. – Stephen Kitt May 22 '19 at 07:56
  • @StephenKitt All right, thanks for your insight. I marked your question as the answer, and will look into the connectivity problem separately. – borizzzzz May 22 '19 at 08:04
  • @Kirjain Here as corporate policy we only allow SSH over a VPN. I advise first of all, understanding the network design and security policies. – Rui F Ribeiro May 22 '19 at 08:11
10

Your SSH package/daemon/service is not installed.

For installing the SSH service on Ubuntu, you run:

sudo apt-get install openssh-server

see Packages - openssh-server - xenial

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227