之前共享可以在windows下正常访问,某天不知道什么原因不能访问了,找不到网络路径。
1. 查看共享配置是否正常
$vi /etc/samba/smb.conf
配置是正常的。
2.重启samba服务
$ 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:
1 2 |
<span style="font-family: 'arial black', sans-serif;"><code>Failed to start samba.service: Unit samba.service is masked. </code></span> |
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
.
Try:
1 2 3 |
<span style="font-family: 'arial black', sans-serif;"><code>systemctl unmask samba systemctl enable samba systemctl restart samba</code></span> |
试了下,不行
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 <ubuntu-devel-discuss@lists.ubuntu.com>
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
Conffiles:
/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).
Homepage: http://www.samba.org
Original-Maintainer: Debian Samba Maintainers <pkg-samba-maint@lists.alioth.debian.org>
$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
问题解决了,可以正常访问共享。但是,引起问题的原因仍未知。