CentOS 6.3 internet上的Samba共享不起作用

CentOS 6.3 internet上的Samba共享不起作用,centos,samba,Centos,Samba,摘要: 这是一个由两部分组成的问题。一个ISP上使用路由器的简单Samba共享不起作用,而另一个ISP使用不同的路由器设置相同且具有相同Samba配置的类似服务器起作用 可能是路由器没有转发端口,尽管它成功地转发了SSH和其他端口,或者是ISP以某种方式阻止了标准Samba端口。它仍然困扰着我,我不知道为什么它不起作用,我仍然会努力缩小原因 第二个问题是,我正在寻找一种商业用途,简单易用(面向最终用户),为少数人和文件提供安全共享,内部托管,外部可在internet上访问,在Windows 7、

摘要:

这是一个由两部分组成的问题。一个ISP上使用路由器的简单Samba共享不起作用,而另一个ISP使用不同的路由器设置相同且具有相同Samba配置的类似服务器起作用

可能是路由器没有转发端口,尽管它成功地转发了SSH和其他端口,或者是ISP以某种方式阻止了标准Samba端口。它仍然困扰着我,我不知道为什么它不起作用,我仍然会努力缩小原因

第二个问题是,我正在寻找一种商业用途,简单易用(面向最终用户),为少数人和文件提供安全共享,内部托管,外部可在internet上访问,在Windows 7、XP、Mac和linux服务器之间,为最终用户提供简单的客户端

stackoverflow之外的一位新朋友帮助解决了sshfs问题。在CentOS上,ssh已经支持sshfs。Windows客户端运行良好,我将尝试使用MACFusion的OSXFUSE,如中所述

另外,为每个人设置linux用户。要允许linux组中的每个人进行写操作,请更改/etc/ssh/sshd_配置中的umask,如中的问题所述。人们首先进入他们的主目录,在那里我放置了指向一个设置了粘性位的共享文件夹的链接,这样他们就不能删除该文件夹。他们可以删除链接,但这很容易放回去。我能看到的唯一问题是缺少文件锁定和自动刷新


原始问题:

我似乎无法通过互联网让Samba在Centos 6.3服务器上工作。我在另一个internet连接上有一个类似的测试服务器,使用完全相同的设置工作正常。我已经检查了两次,确保端口被转发到internet(尽管不确定如何测试它们是否真正打开),仔细检查samba配置,现在只是共享/tmp。用户帐户已设置,它可以通过ssh登录并访问/tmp,samba密码设置相同。我无法ping服务器,但这是因为所有者/工作人员将路由器或IP设置为不可ping。SSH和HTTPS apache在服务器上运行良好,端口转发方式相同。我还不能在本地网络中测试共享,因为我不在那里,但我认为它应该在内部工作。当尝试从Windows7连接时,它只是超时,没有提示,它从未连接,而我自己的internet连接上的测试服务器始终在内部和外部工作

任何帮助都将不胜感激

这项要求是一个易于使用的内部托管共享文件夹,而不是在Windows 7、XP、mac和linux服务器之间使用“dropbox”,通过外部internet连接工作。它不会被大量使用,但应该快速、易于在客户端访问/设置,并且对业务安全。如果在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在尝试以\的身份访问共享时超时,这在测试服务器上正常工作:

# 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
(我有一个截图,但新用户不能发布)

搜索错误0x80004005将导致

我已检查了工作组、共享设置并重新启动了windows。既然测试共享可以工作,我想Windows机器可以工作了。我将继续介绍细节

再次编辑:

再次遵循故障排除指南:

将smb.conf简化为:

# cat /etc/samba/smb.conf
[tmp]
comment = temporary files
path = /tmp
read only = yes
/etc/resolv.conf正在使用ISPs服务器,它们可以正常工作。它们与工作服务器的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:

# 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  ]
路由器上的“响应互联网端口上的Ping”通常是关闭的。我在Windows客户端和服务器上都打开了它。每个人都可以互相敲打,共享仍然不起作用

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)
继续

继续:

我们没有限制连接或使用inetd

log.nmbd不会报告任何问题

nmblookup-B BIGSERVERSAMBA使用服务器名称工作

nmblookup-B ACLIENT*在使用windows客户端名称或外部IP地址的所有日志文件上失败

nmblookup-d2`*'失败

“如果您的电脑和服务器不在同一子网中,则需要使用-B选项将广播地址设置为电脑子网的广播地址

如果您的子网掩码和广播地址不正确,此测试可能会失败。(请参阅上面的测试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使用也有同样的问题,即使提供了user和passwd

nmblookup-M工作组返回网络上的本地windows机器,而在我的测试服务器上,它返回测试机器本地的客户端。也许这里有一个关于工作组的问题
# 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
# yum -y install tcpdump
# tcpdump -i eth0 "port 137 or port 138 or port 139 or port 445"
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
01:25:48.631173 IP 192.168.0.10.54032 > 192.168.0.1.microsoft-ds: Flags [S], seq 4008761512, win 5840, options [mss 1460,sackOK,TS val 136010468 ecr 0,nop,wscale 7], length 0
01:25:48.631198 IP 192.168.0.1.microsoft-ds > 192.168.0.10.54032: Flags [S.], seq 2220435566, ack 4008761513, win 14480, options [mss 1460,sackOK,TS val 15507714 ecr 136010468,nop,wscale 7], length 0
01:25:48.631397 IP 192.168.0.10.54032 > 192.168.0.1.microsoft-ds: Flags [.], ack 1, win 46, options [nop,nop,TS val 136010468 ecr 15507714], length 0
01:25:48.642171 IP 192.168.0.10.54032 > 192.168.0.1.microsoft-ds: Flags [P.], seq 1:184, ack 1, win 46, options [nop,nop,TS val 136010479 ecr 15507714], length 183SMB PACKET: SMBnegprot (REQUEST)
...
client min protocol = NT1  
client max protocol = SMB3