Installed 15.04, cannot restart ssh daemon [duplicate]
15.04 and newer:
Use this command:
sudo systemctl restart ssh
To restart the SSH server/daemon.
Going forward with systemd
starting with Ubuntu 15.04, you now use this syntax to stop, start, or restart services:
sudo systemctl <action> <service-name>
Pre 15.04:
It should be as simple as (tested on a fresh install with openssh-server)
sudo stop ssh
sudo start ssh
As it leverages upstart, this is The Best Way™ to do it, rather than using /etc/init.d/ssh, service
, or invoking sshd directly. Make sure to run both commands; if you get an error on stop ssh
, start ssh
anyway and see what it says—the service could already be stopped.
(I would recommend stop
/start
over restart
, unless you are trying to restart a system remotely. If ssh is already stopped, restart
will not start it.)
If those commands don't work, you are probably either experiencing a bug or have tinkered too far with your system, in which case you at least know what the problem isn't.