I have openssh-server
installed but I'd like to sometimes leave the sshd
service off by default at boot, and only start it from the terminal as needed.
Based on the the advice of many other questions, enabling and disabling the service at boot should be simple on my systemd
using 16.04 distro:
$sudo systemctl disable sshd.service
That seems to work. However, I can no longer enable the service at boot after that:
$sudo systemctl enable sshd.service
Failed to execute operation: No such file or directory
Even un-installing and re-installing openssh-server
doesn't fix it, but a purge
does.
How do I re-enable sshd
at boot once I've disabled it via systemd
?
Note that even in this messed up state I can still manually start and stop the service via service ssh
[start|stop]`.
sshd
at boot and enable it as needed from the terminal. This is actually working since I can useservice ssh start
to start it. However, what I found is that if I want to again enable it at boot viasystemctrl
it doesn't work: the ssh/systemd association seems permanently broken now (solvable via purge which changes all my keys, etc). I edited the question to make it clearer the problem is aboutsystemctrl enable
. – BeeOnRope Nov 21 '17 at 18:37