【发布时间】:2012-09-13 04:12:59
【问题描述】:
总结:
这是一个两部分的问题。一个带有路由器的 ISP 上的简单 Samba 共享不起作用,而另一个具有不同路由器的 ISP 设置相同,而具有相同 Samba 配置的类似服务器可以工作。
这似乎是路由器没有转发端口,尽管它成功地转发了 SSH 和其他端口,或者 ISP 以某种方式阻止了标准 Samba 端口。它仍然困扰着我,我无法弄清楚为什么它不起作用,我仍然会尝试缩小原因。
第二个问题是我正在寻找一种商业用途、简单、易于使用(对于最终用户)、少数人和文件的安全共享、内部托管和外部互联网访问、Windows 7 之间、XP、Mac 和 linux 服务器,为最终用户提供简单的客户端。
stackoverflow 之外的一位新朋友帮助使用 sshfs 作为解决方案。在 CentOS 上 ssh 已经支持 sshfs。 Windows 客户端win-sshfs 运行良好,我将尝试使用UO 中描述的 MACFusion 的 OSXFUSE。
另外,为每个人设置 linux 用户。要允许 linux 组中的每个人都可以写入,请更改此问题 serverfault 中描述的 /etc/ssh/sshd_config 中的 umask。人们首先进入他们的主目录,我在其中放置了指向设置了粘性位的共享文件夹的链接,因此他们无法删除该文件夹。他们可以删除链接,但这很容易恢复。我能看到的唯一问题是缺乏文件锁定和缺乏自动刷新。
原问题:
我似乎无法通过 Internet 让 Samba 在 Centos 6.3 服务器上运行。我在另一个互联网连接上有一个类似的测试服务器,在完全相同的设置下工作正常。我已经通过http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/diagnosis.html 两次,确保端口被转发到互联网(虽然不确定如何测试它们是否真正打开),仔细检查了 samba 配置,它现在只是共享 /tmp。用户帐户已设置,它可以 ssh 进入并访问 /tmp,并且 samba 密码设置相同。我无法 ping 服务器,但那是因为路由器或 IP 设置为无法被所有者/工作 ping 通。 SSH 和 HTTPS apache 在服务器上运行良好,端口转发方式相同。由于我不在那里,我还无法在本地网络中测试共享,但我认为它应该在内部工作。当尝试从 Windows 7 连接时,它只是超时,没有提示并且它从未连接,而我自己的互联网连接上的测试服务器始终在内部和外部工作。
任何帮助将不胜感激。
要求是一个易于使用的内部托管共享文件夹替代使用“dropbox”,以便在通过外部 Internet 连接工作的 Windows 7、XP、mac 和 linux 服务器之间使用。它不会被大量使用,但应该快速、易于在客户端访问/设置,并且对业务来说是安全的。如果有任何替代方案可以安装在 CentOS 上,那就太好了。
谢谢! 安德鲁
编辑,细节:
端口被转发:
(我有一张图片,但作为新用户我不能发布)137、138、139、445 现在都使用 TCP 和 UDP 转发以进行测试。
smb.conf 设置简单,与工作测试服务器完全相同:
# cat /etc/samba/smb.conf
[global]
workgroup=WORKGROUP
log level = 3
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
[tmp]
comment = temporary files
path = /tmp
read only = yes
Samba 重新启动以进行良好的衡量:
# service smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
Windows 7 在尝试以 \ 访问共享时超时,这在测试服务器上运行良好:
(我有截图但新用户不能发帖)
对错误 0x80004005 的搜索结果为 http://answers.microsoft.com/en-us/windows/forum/windows_vista-networking/cannot-access-network-share-get-unspecified-error/9f840844-9d5b-e011-8dfc-68b599b31bf5
我检查了工作组、共享设置并重新启动了窗口。由于测试共享有效,我认为 Windows 机器正在工作。我将继续详细说明。
再次编辑:
再次按照故障排除指南进行操作:
将 smb.conf 简化为:
# cat /etc/samba/smb.conf
[tmp]
comment = temporary files
path = /tmp
read only = yes
/etc/resolv.conf 正在使用 ISP 服务器并且它们可以工作。它们与工作服务器的 DNS 不同,但位于不同的 ISP 上:
# nslookup google.com
Server: 71.242.0.12
Address: 71.242.0.12#53
Non-authoritative answer:
Name: google.com
Address: 74.125.228.2
我用 IP 地址做所有事情,所以我不知道 DNS 会发挥作用。
为了好玩,我在 smb.conf 中添加了 dns proxy = no,但这并没有帮助。
/var/log/samba/log.smbd 不会报告与工作服务器不同的任何内容:
[2012/09/20 16:59:41, 0] smbd/server.c:1141(main)
smbd version 3.5.10-125.el6 started.
Copyright Andrew Tridgell and the Samba Team 1992-2010
[2012/09/20 16:59:41.484699, 0] param/loadparm.c:7648(lp_do_parameter)
Global parameter dns proxy found in service section!
[2012/09/20 16:59:41.486645, 0] printing/print_cups.c:109(cups_connect)
Unable to connect to CUPS server localhost:631 - Connection refused
[2012/09/20 16:59:41.486809, 0] printing/print_cups.c:468(cups_async_callback)
failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
[2012/09/20 16:59:41.507198, 0] smbd/server.c:501(smbd_open_one_socket)
smbd_open_once_socket: open_socket_in: Address already in use
[2012/09/20 16:59:41.507407, 0] smbd/server.c:501(smbd_open_one_socket)
smbd_open_once_socket: open_socket_in: Address already in use
[2012/09/20 17:00:39, 0] smbd/server.c:1141(main)
smbd version 3.5.10-125.el6 started.
Copyright Andrew Tridgell and the Samba Team 1992-2010
[2012/09/20 17:00:39.513793, 0] printing/print_cups.c:109(cups_connect)
Unable to connect to CUPS server localhost:631 - Connection refused
[2012/09/20 17:00:39.513955, 0] printing/print_cups.c:468(cups_async_callback)
failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
[2012/09/20 17:00:39.535458, 0] smbd/server.c:501(smbd_open_one_socket)
smbd_open_once_socket: open_socket_in: Address already in use
[2012/09/20 17:00:39.535689, 0] smbd/server.c:501(smbd_open_one_socket)
smbd_open_once_socket: open_socket_in: Address already in use
但是,工作服务器会在名为 log 的目录中创建一个日志文件。非工作服务器没有。
测试参数:
# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[tmp]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
[tmp]
comment = temporary files
path = /tmp
继续...
继续:
nmb 也在运行:
# service nmb restart
Shutting down NMB services: [ OK ]
Starting NMB services: [ OK ]
“在 Internet 端口上响应 Ping”通常在路由器上处于关闭状态。我在 Windows 客户端和服务器上都打开了它。可以互相ping通,共享还是不行。
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\xxxx>ping xxxx
Pinging xxxx with 32 bytes of data:
Reply from xxxx: bytes=32 time=25ms TTL=51
Reply from xxxx: bytes=32 time=23ms TTL=51
Reply from xxxx: bytes=32 time=26ms TTL=51
Reply from xxxx: bytes=32 time=24ms TTL=51
Ping statistics for xxxx:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 23ms, Maximum = 26ms, Average = 24ms
# ping xxxx -c 5
PING xxxx (xxxx) 56(84) bytes of data.
64 bytes from xxxx: icmp_seq=1 ttl=251 time=20.7 ms
64 bytes from xxxx: icmp_seq=2 ttl=251 time=24.6 ms
64 bytes from xxxx: icmp_seq=3 ttl=251 time=21.4 ms
64 bytes from xxxx: icmp_seq=4 ttl=251 time=25.3 ms
64 bytes from xxxx: icmp_seq=5 ttl=251 time=22.9 ms
--- xxxx ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4029ms
rtt min/avg/max/mdev = 20.776/23.022/25.319/1.764 ms
继续...
继续:
iptables 已关闭:
# iptables -L -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
SELinux 已关闭:
# sestatus
SELinux status: disabled
smbclient 在 samba 中使用用户设置从 samba 服务器到其本地 IP 和外部 IP。 Windows 客户端获取:
Connection to <ip addr> failed (Error NT_STATUS_UNSUCCESSFUL)
Samba 作为守护程序/服务运行,而 netbios-ssn 处于侦听模式:
# netstat -a|grep netbios-ssn
tcp 0 0 *:netbios-ssn *:* LISTEN
继续...
继续:
我们没有限制连接或使用 inetd。
log.nmbd 没有报告任何问题。
nmblookup -B BIGSERVER SAMBA 使用服务器名称工作
nmblookup -B ACLIENT * 失败所有使用 Windows 客户端名称或外部 IP 地址的日志文件
nmblookup -d 2 `*'。 失败
"如果您的 PC 和服务器不在同一子网中,则需要使用 -B 选项将广播地址设置为 PC 子网的地址。
如果您的子网掩码和广播地址不正确,此测试可能会失败。 (参考上面的测试3注)。”
我不确定这里,因为我们要通过互联网,我们需要这些来匹配和工作吗?
smbclient //BIGSERVER/TMP 工作
在客户端:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\xxxx>net view \\xxxx (ip addr)
System error 53 has occurred.
The network path was not found.
C:\Users\xxxx>
net use 有同样的问题,即使提供用户和密码。
nmblookup -M WORKGROUP 返回网络上的本地 Windows 机器,而在我的测试服务器上,它返回测试机器本地的客户端。也许工作组在另一台机器上存在问题,但如果这是问题,其他人将如何从其他网络连接?
我也尝试过首选大师 = 是的。
samba howto 的第 2 页。
更新:一个新朋友说试试nmap看看检查端口:
# nmap -sS -P0 -sV -O xxxx
Starting Nmap 5.51 ( ) at 2012-09-21 11:09 EDT
Nmap scan report for xxxx (xxxx)
Host is up (0.024s latency).
Not shown: 995 filtered ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 5.3 (protocol 2.0)
25/tcp open smtp Postfix smtpd
110/tcp open pop3 Dovecot pop3d
443/tcp open ssl/http Apache httpd 2.2.15 ((CentOS))
9100/tcp open jetdirect?
Warning: OSScan results may be unreliable because we could not find at
least 1 open and 1 closed port
OS fingerprint not ideal because: Missing a closed TCP port so results
incomplete
No OS matches for host
Service Info: Host: xxxx
由于 Samba 端口未显示,我认为路由器或 ISP 此时未转发/阻止端口。
至于分享的解决方案,我正在尝试使用 windows 和 mac 客户端的 sshfs。
【问题讨论】:
-
如果此处的测试/诊断步骤:samba.org/samba/docs/man/Samba-HOWTO-Collection/… 产生任何错误,请考虑将它们添加到您的帖子中。
-
谢谢佩里!我现在正在这样做,我点击了保存编辑,它们似乎丢失了,我将不得不重新编写它们......