Celeb Glow
news | March 13, 2026

cannot re-enable sshd after systemd mask

After disabling sshd, I'm having issues re-enabling/starting it via systemctl.

I'm sure I've hosed something, but this is what I did:

  • ~fresh xubuntu 16.04.2 install
  • apt install openssh-server
    • probably had to manually enabled it; I don't remember
    • kept default config file as-is (accessing over local LAN only)
  • (ssh'd in successfully to scp over data from a previous machine)
  • attempted to disable sshd, as I didn't intend to use it further
    • systemctl stop sshd && systemctl disable sshd && systemctl mask sshd
    • (did I do something wrong here?)
  • now I need ssh access again, so I am trying to enable:
    • systemctl unmask sshd - outputs that it removed the /dev/null symlink
    • systemctl enable sshd Failed to execute operation: No such file or directory

Searching for solutions, I didn't find much besides what (I think) I already tried. I have re-installed apt remove openssh-server && apt install openssh-server, but I am getting the same result.

An systemctl status sshd shows:

sshd.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead)

I'm not familiar with systemctl. Help would be greatly appreciated!!

2

2 Answers

It appears that sshd is an "alias" of sorts for ssh.service; when you install openssh-server, symlink(s) are set up mapping this.

However, when you systemctl disable sshd those symlinks are deleted, and are NOT restored with an enable.

The solutions is to systemctl enable ssh.service

I stumbled over this question with the same trace:

$ sudo systemctl start sshd.service
Failed to start sshd.service: Unit sshd.service is masked.

As suggested, systemctl enable ssh.service did not work.

It turned out that I had removed openssh-service.

dpkg -l openssh-server

I needed to install it again:

sudo apt install openssh-server

And the service is back:

$ systemctl status sshd
● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2021-09-15 13:30:50 CEST; 1min 14s ago Docs: man:sshd(8) man:sshd_config(5) Main PID: 1266628 (sshd) Tasks: 1 (limit: 18525) Memory: 1.5M CGroup: / └─1266628 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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