在 Centos 6 上设置 samba 共享时缺少步骤

在 Centos 6 上设置 samba 共享时缺少步骤

我在 Centos 服务器上设置文件和打印机共享时遇到了麻烦(通过 Samba)。网络和常规配置都很好,因为在同一台服务器上访问 cups 网页管理和由 Apache 提供服务的网站都很顺利。

因此看起来问题出在 Samba 层面。

为了确保这不是一个安全问题,我禁用了 iptables 和 SELinux - 反正这也不太重要,因为服务器位于本地网络上,对互联网的访问受到限制。我想确保在添加额外的安全措施之前基本配置可以正常工作。

客户端主要是 Win7。没有一个可以连接。从 Windows 机器发出的“net view”命令没有显示有关服务器的任何信息,尽管它们可以连接到托管在那里的网站。

这是我的 smb.conf:

[global]
        workgroup = WORKGROUP
        netbios name = kayak
        server string = Kayak
        log level = 3
        log file = /var/log/samba/log.%m
        max log size = 50
        password server = None
        encrypt passwords = no
        guest ok = yes
        security = user
        load printers = yes
        printing = cups
        printcap name = cups
[homes]
        comment = Home Directories
        writable = no
        browseable = no
[public]
        comment = Public dir
        path = /samba
        browseable = yes
        writable = yes
        Guest Ok = yes
        public = yes
[printers]
        path = /var/spool/samba/print
        printer = IBMInfoP
        browseable = yes
        public = Yes
        guest ok = Yes
        writable = No
        printable = yes
        use client driver = yes
        printer admin = @ntadmins

以下是 samba 启动时的 3 级日志:

[2011/10/02 12:27:31,  0] smbd/server.c:1119(main)
  smbd version 3.5.4-68.el6_0.2 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2010
[2011/10/02 12:27:31.240941,  2] lib/tallocmsg.c:106(register_msg_pool_usage)
  Registered MSG_REQ_POOL_USAGE
[2011/10/02 12:27:31.241018,  2] lib/dmallocmsg.c:77(register_dmalloc_msgs)
  Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED
[2011/10/02 12:27:31.241107,  3] param/loadparm.c:9167(lp_load_ex)
  lp_load_ex: refreshing parameters
Initialising global parameters
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
[2011/10/02 12:27:31.241278,  3] ../lib/util/params.c:550(pm_process)
  params.c:pm_process() - Processing configuration file "/etc/samba/smb.conf"
[2011/10/02 12:27:31.241365,  3] param/loadparm.c:7851(do_section)
  Processing section "[global]"
[2011/10/02 12:27:31.241493,  2] param/loadparm.c:7868(do_section)
  Processing section "[homes]"
[2011/10/02 12:27:31.241634,  2] param/loadparm.c:7868(do_section)
  Processing section "[public]"
[2011/10/02 12:27:31.241768,  2] param/loadparm.c:7868(do_section)
  Processing section "[printers]"
[2011/10/02 12:27:31.241933,  1] param/loadparm.c:7614(lp_do_parameter)
  WARNING: The "printer admin" option is deprecated
[2011/10/02 12:27:31.242056,  3] param/loadparm.c:6316(lp_add_ipc)
  adding IPC service
[2011/10/02 12:27:31.242230,  3] printing/pcap.c:136(pcap_cache_reload)
  reloading printcap cache
[2011/10/02 12:27:31.247490,  3] printing/pcap.c:243(pcap_cache_reload)
  reload status: ok
[2011/10/02 12:27:31.247630,  3] param/loadparm.c:6355(lp_add_printer)
  adding printer service HP_PSC_1500_series
[2011/10/02 12:27:31.247846,  2] lib/interface.c:340(add_interface)
  added interface eth1 ip=192.168.0.3 bcast=192.168.0.255 netmask=255.255.255.0
[2011/10/02 12:27:31.248031,  3] smbd/server.c:1161(main)
  loaded services
[2011/10/02 12:27:31.248097,  3] smbd/server.c:1176(main)
  Becoming a daemon.
[2011/10/02 12:27:31.250725,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.250785,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.250815,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.250900,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 2
[2011/10/02 12:27:31.250932,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 1
[2011/10/02 12:27:31.251207,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 2
[2011/10/02 12:27:31.251305,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.251344,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.251400,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.251427,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.251452,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.251824,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.251906,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.251939,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.251964,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252065,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252098,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252138,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252163,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252201,  3] auth/token_util.c:436(create_local_nt_token)
  Failed to fetch domain sid for WORKGROUP
[2011/10/02 12:27:31.252237,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252289,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252315,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252336,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252409,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252437,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252461,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252483,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252517,  3] auth/token_util.c:467(create_local_nt_token)
  Failed to fetch domain sid for WORKGROUP
[2011/10/02 12:27:31.252568,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252597,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252623,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252647,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.252887,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.252978,  3] lib/privileges.c:63(get_privileges)
  get_privileges: No privileges assigned to SID [S-1-22-1-0]
[2011/10/02 12:27:31.253032,  3] lib/privileges.c:63(get_privileges)
  get_privileges: No privileges assigned to SID [S-1-5-2]
[2011/10/02 12:27:31.253067,  3] lib/privileges.c:63(get_privileges)
  get_privileges: No privileges assigned to SID [S-1-5-11]
[2011/10/02 12:27:31.256352,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.256395,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.256421,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.256541,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.256749,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.256786,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.256812,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.256879,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.256942,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.256971,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257011,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257101,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257155,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257181,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257205,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257243,  3] auth/token_util.c:436(create_local_nt_token)
  Failed to fetch domain sid for WORKGROUP
[2011/10/02 12:27:31.257274,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257326,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257351,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257372,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257441,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257469,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257494,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257518,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257576,  3] auth/token_util.c:467(create_local_nt_token)
  Failed to fetch domain sid for WORKGROUP
[2011/10/02 12:27:31.257613,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257641,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257666,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257690,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.257937,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.257980,  3] lib/privileges.c:63(get_privileges)
  get_privileges: No privileges assigned to SID [S-1-5-21-3050736844-1377071369-2217750771-501]
[2011/10/02 12:27:31.258017,  3] lib/privileges.c:63(get_privileges)
  get_privileges: No privileges assigned to SID [S-1-22-2-99]
[2011/10/02 12:27:31.258055,  3] lib/privileges.c:63(get_privileges)
  get_privileges: No privileges assigned to SID [S-1-5-2]
[2011/10/02 12:27:31.258088,  3] lib/privileges.c:63(get_privileges)
  get_privileges: No privileges assigned to SID [S-1-5-32-546]
[2011/10/02 12:27:31.258191,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.258224,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.258241,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.258281,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.258307,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.258320,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.258332,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.258369,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.258397,  3] smbd/sec_ctx.c:210(push_sec_ctx)
  push_sec_ctx(0, 0) : sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.258422,  3] smbd/uid.c:429(push_conn_ctx)
  push_conn_ctx(0) : conn_ctx_stack_ndx = 0
[2011/10/02 12:27:31.258436,  3] smbd/sec_ctx.c:310(set_sec_ctx)
  setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2011/10/02 12:27:31.258477,  3] smbd/sec_ctx.c:418(pop_sec_ctx)
  pop_sec_ctx (0, 0) - sec_ctx_stack_ndx = 0
[2011/10/02 12:27:31.258535,  3] printing/printing.c:1412(start_background_queue)
  start_background_queue: Starting background LPQ thread
[2011/10/02 12:27:31.258750,  3] ../lib/util/util_net.c:68(interpret_string_addr_internal)
  interpret_string_addr_internal: getaddrinfo failed for name :: [Address family for hostname not supported]
[2011/10/02 12:27:31.258891,  3] ../lib/util/util_net.c:68(interpret_string_addr_internal)
  interpret_string_addr_internal: getaddrinfo failed for name :: [Address family for hostname not supported]
[2011/10/02 12:27:31.259145,  2] smbd/server.c:721(smbd_parent_loop)
  waiting for connections

我通常是一名开发人员,而不是管理员,所以我可能忽略了一些显而易见的东西……启动日志中的某些内容似乎很可疑,但我不确定它们有多严重,以及如何修复它们。有什么提示告诉我应该去哪里找吗?

答案1

好吧,好吧,我真丢脸。

事实证明这是 Windows 的问题:工作组未正确设置 - 并且所有机器都以相同的方式设置。

现在一切都正常了。很抱歉用一个愚蠢的问题浪费了你的时间。对于那些追随我脚步的人的建议:检查问题是否真的出在服务器上。:/

@grawity:你让我很担心,但至少在 CentOs 6 上,smb 服务似乎同时包含 nmbd 和 smbd 守护进程。奇怪的是,我看不到 nmbd 进程在运行,但它看起来运行良好。我会为你的评论点赞,因为它为我指明了正确的方向:命名空间 :)

相关内容