Cannot restart samba, samba.service is masked


1. 查看共享配置是否正常

$vi /etc/samba/smb.conf



$ service smbd restart

Failed to restart smbd.service: Unit smbd.service is masked.


When I try to restart Samba, I am receiving the following error message:

Failed to start samba.service: Unit samba.service is masked.

In addition, when I run systemctl, it shows smbd.service in red showing failed.

At the same time restart began to fail, I have lost the share ability in folders created and cannot access. Any help would be appreciated!!!


Try service smbd restart.


systemctl unmask samba
systemctl enable samba
systemctl restart samba


Unit samba.service does not exist, proceeding anyway

apt install samba

Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory
Processing triggers for libc-bin (2.26-0ubuntu2.1) …

ls -la /etc/systemd/system/samba-ad-dc.service
lrwxrwxrwx 1 root root 9 3月 3 18:01 /etc/systemd/system/samba-ad-dc.service -> /dev/null

dpkg -s samba
Package: samba
Status: install ok installed
Priority: optional
Section: net
Installed-Size: 10941
Maintainer: Ubuntu Developers <>
Architecture: amd64
Version: 2:4.6.7+dfsg-1ubuntu3.2
Depends: adduser, libpam-modules, libpam-runtime (>= 1.0.1-11), lsb-base (>= 4.1+Debian), procps, python (<< 2.8), python-dnspython, python-samba, samba-common (= 2:4.6.7+dfsg-1ubuntu3.2), samba-common-bin (= 2:4.6.7+dfsg-1ubuntu3.2), tdb-tools, init-system-helpers (>= 1.18~), python (>= 2.7~), python2.7:any, python:any (<< 2.8), python:any (>= 2.7~), libattr1 (>= 1:2.4.46-8), libbsd0 (>= 0.0), libc6 (>= 2.14), libldb1 (>= 0.9.21), libpopt0 (>= 1.14), libpython2.7 (>= 2.7), libtalloc2 (>= 2.0.4~git20101213), libtdb1 (>= 1.2.7+git20101214), libtevent0 (>= 0.9.16), libwbclient0 (= 2:4.6.7+dfsg-1ubuntu3.2), samba-libs (= 2:4.6.7+dfsg-1ubuntu3.2)
Pre-Depends: dpkg (>= 1.15.6~)
Recommends: attr, logrotate, samba-dsdb-modules, samba-vfs-modules
Suggests: bind9 (>= 1:9.5.1), bind9utils, ctdb, ldb-tools, ntp | chrony (>= 3.0-1), smbldap-tools, ufw, winbind
Enhances: bind9, ntp
/etc/cron.daily/samba f6519535df7964f95cdd7db501bf3ad2
/etc/init.d/nmbd c5945c7ddd7c64e44095c0702eb13095
/etc/init.d/samba-ad-dc 53f4dbe1f4fefabb82f98ab56c2753ef
/etc/init.d/smbd 5218124fdeda5bf0035704c9c97104e6
/etc/logrotate.d/samba af6680b8a624ba7d1f6730af61262e8d
/etc/ufw/applications.d/samba 9d474788f9a1955e16134f2794be473d
Description: SMB/CIFS file, print, and login server for Unix
Samba is an implementation of the SMB/CIFS protocol for Unix systems,
providing support for cross-platform file and printer sharing with
Microsoft Windows, OS X, and other Unix systems. Samba can also function
as an NT4-style domain controller, and can integrate with both NT4 domains
and Active Directory realms as a member server.
This package provides the components necessary to use Samba as a stand-alone
file and print server or as an NT4 or Active Directory domain controller.
For use in an NT4 domain or Active Directory realm, you will also need the
winbind package.
This package is not required for connecting to existing SMB/CIFS servers
(see smbclient) or for mounting remote filesystems (see cifs-utils).
Original-Maintainer: Debian Samba Maintainers <>

$systemctl mask samba-ad-dc.service
$apt-get install -f
Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 0 to remove and 64 not upgraded.
$apt install samba
Reading package lists… Done
Building dependency tree
Reading state information… Done
samba is already the newest version (2:4.6.7+dfsg-1ubuntu3.2).
0 upgraded, 0 newly installed, 0 to remove and 64 not upgraded.
$ service smbd restart
$service nmbd restart