所以我试图在我的家庭网络上设置一些共享,但经过 2 天的谷歌搜索后我无法让它工作。我已将其添加到firewalld,但我所看到的只是它对打印机不满意。 PC 和服务器都运行在 Fedora 21 上。
谢谢罗布
[root@localhost samba]# systemctl status smb -l
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled)
Active: active (running) since Sat 2014-12-27 12:07:01 GMT; 32min ago
Main PID: 10308 (smbd)
Status: "smbd: ready to serve connections..."
CGroup: /system.slice/smb.service
├─10308 /usr/sbin/smbd
└─10309 /usr/sbin/smbd
Dec 27 12:07:01 localhost.localdomain smbd[10309]: STATUS=daemon 'smbd' finished starting up and ready to serve connectionsfailed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Dec 27 12:08:01 localhost.localdomain smbd[10314]: [2014/12/27 12:08:01.788537, 0]../source3/printing/print_cups.c:151(cups_connect)
Dec 27 12:08:01 localhost.localdomain smbd[10309]: [2014/12/27 12:08:01.788826, 0] ../source3/printing/print_cups.c:528(cups_async_callback)
Dec 27 12:08:01 localhost.localdomain smbd[10309]: failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Dec 27 12:21:02 localhost.localdomain smbd[10550]: [2014/12/27 12:21:02.537410, 0] ../source3/printing/print_cups.c:151(cups_connect)
Dec 27 12:21:02 localhost.localdomain smbd[10309]: [2014/12/27 12:21:02.537767, 0] ../source3/printing/print_cups.c:528(cups_async_callback)
Dec 27 12:21:02 localhost.localdomain smbd[10309]: failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Dec 27 12:34:03 localhost.localdomain smbd[10713]: [2014/12/27 12:34:03.319755, 0] ../source3/printing/print_cups.c:151(cups_connect)
Dec 27 12:34:03 localhost.localdomain smbd[10309]: [2014/12/27 12:34:03.320213, 0] ../source3/printing/print_cups.c:528(cups_async_callback)
Dec 27 12:34:03 localhost.localdomain smbd[10309]: failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
_
[root@localhost samba]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[Music]"
Processing section "[Films]"
Processing section "[HLI]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = MYGROUP
interfaces = lo, eth0
map to guest = Bad User
log file = /var/log/samba/log.%m
max log size = 1024
unix extensions = No
socket options = TCP_NODELAY SO_RCVBUF=131072 SO_SNDBUF=131072
load printers = No
idmap config * : backend = tdb
hosts allow = 127., 134.173.
aio read size = 16384
aio write size = 16384
use sendfile = Yes
map hidden = Yes
map system = Yes
store dos attributes = Yes
[Music]
comment = music magic blah blah
path = /share/music
valid users = user, root
read only = No
guest ok = Yes
[Films]
comment = moving pics!
path = /share/films
valid users = user, root
read only = No
guest ok = Yes
[HLI]
comment = HLI Files Here
path = /share/HLI
valid users = user, root
read only = No
guest ok = Yes
_
[root@localhost ~]# netstat --inet --inet6 -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 1184/perl
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1170/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1109/sshd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1131/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1131/smbd
tcp6 0 0 :::22 :::* LISTEN 1109/sshd
tcp6 0 0 :::445 :::* LISTEN 1131/smbd
tcp6 0 0 :::9090 :::* LISTEN 1/systemd
tcp6 0 0 :::139 :::* LISTEN 1131/smbd
udp 0 0 0.0.0.0:21246 0.0.0.0:* 1075/dhclient
udp 0 0 0.0.0.0:10000 0.0.0.0:* 1184/perl
udp 0 0 192.168.122.1:53 0.0.0.0:* 1170/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 1170/dnsmasq
udp 0 0 0.0.0.0:68 0.0.0.0:* 1075/dhclient
udp 0 0 0.0.0.0:123 0.0.0.0:* 681/chronyd
udp 0 0 127.0.0.1:323 0.0.0.0:* 681/chronyd
udp6 0 0 :::123 :::* 681/chronyd
udp6 0 0 :::16665 :::* 1075/dhclient
udp6 0 0 ::1:323 :::* 681/chronyd
raw6 0 0 :::58 :::* 7 753/NetworkManager
_
[root@localhost ~]# tcpdump -i eth0 -n \( tcp port 139 or tcp port 445 \) and host 192.168.1.111
tcpdump: eth0: No such device exists
(SIOCGIFHWADDR: No such device)
答案1
问题似乎是nmbd
没有运行。如果是的话,netstat
会打印这样一行:
udp 0 0 0.0.0.0:137 0.0.0.0:* 4691/nmbd
没有nmbd
系统是在网络上看不到的。但应该可以连接到它。看来这192.168.122.1
是您的 LAN IP 地址。在 SMB 浏览器中输入此地址。在 Windows 客户端上,您将进入\\192.168.122.1
Windows 资源管理器。 Linux 客户端可能需要类似smb://192.168.122.1
.
在 shell 中你可以这样做:
smbclient -I 192.168.122.1 -L //foo -U yourusername
smbclient -I 192.168.122.1 //foo/sharename -U yourusername
此外,您的 LAN 接口名称不是,eth0
因此输入smb.conf
( interfaces = lo, eth0
) 没有意义。当然,在与tcpdump
您核对时也应该使用正确的名称。ip addr
显示接口名称和地址。
可能需要在防火墙中允许 NetBIOS 广播。