0

I am having difficulty disabling sshd. [I want it to be available but not autorun]

I followed How to disable autostart of SSHD in Ubuntu 15.04 but to no avail:

$ ps -ef|grep sshd
root       742     1  0 11:43 ?        00:00:00 /usr/sbin/sshd -D

ie it is still running. And yet

$ systemctl status sshd
● sshd.service - OpenBSD Secure Shell server
Loaded: loaded (/etc/systemd/system/sshd.service; disabled; vendor preset: enabled)
Active: inactive (dead)

IOW ps shows its active while systemctl shows not

Rushi
  • 183

2 Answers2

1

You are being led up the garden path by a service unit file created by the local administrator in /etc/systemd/system/sshd.service. That is not the Ubuntu version 15 packaged service unit.

There are three of the latter, and they live at:

  • /lib/systemd/system/ssh.socket — socket unit for the SSH socket when systemd is doing the listening for connections
  • /lib/systemd/system/ssh@.service — template service unit, instantiated by connections made to the SSH socket when systemd is doing the listening
  • /lib/systemd/system/ssh.service — service unit for when OpenSSH is doing the listening for connections

As noted in comments to answers in the original question, the name of the SSH service on Ubuntu Linux and Debian Linux is ssh not sshd.

Further reading

JdeBP
  • 3,979
0

use this

systemctl disable ssh.socket
Avicii
  • 1