Samba引入的奇怪问题

最近在整理公司的网络架构,尝试把事情做得有条理一些。
NAS001的samba服务用了很久一直很稳定,服务器配置是Ubuntu 14.04 LTS的桌面版,开了SSH,所以一直用SSH管理。
因为想尝试增加登录验证的共享文件夹,所以在/etc/samba/smb.conf里面加好配置之后,想本地用smbclient登录调试。结果本机没有smbclient这个包,于是apt-get装好之后,发现Win 10再也无法访问NAS上的任何文件夹了! 体现为用\\192.168.x.x可以在资源管理器看到NAS的共享文件夹,但双击打开却提示

无法访问。您可能没有权限使用网络资源,请与这台服务器的管理员联系以查明您是否有访问权限。
指定的网络名不再可用

看到有人说查log也许有线索,于是打开/var/log/samba,找到自己机器名对应的log,发现这样一段信息

[2018/01/17 15:36:53.937032,  0] ../source3/lib/popt_common.c:68(popt_s3_talloc_log_fn)
  talloc: access after free error - first free may be at ../source3/smbd/posix_acls.c:776
[2018/01/17 15:36:53.937061,  0] ../source3/lib/popt_common.c:68(popt_s3_talloc_log_fn)
  Bad talloc magic value - access after free
[2018/01/17 15:36:53.937073,  0] ../source3/lib/util.c:789(smb_panic_s3)
  PANIC (pid 17424): Bad talloc magic value - access after free
[2018/01/17 15:36:53.937781,  0] ../source3/lib/util.c:900(log_stack_trace)
  BACKTRACE: 35 stack frames:
   #0 /usr/lib/x86_64-linux-gnu/samba/libsmbregistry.so.0(log_stack_trace+0x1a) [0x7f2208d7b1da]
   #1 /usr/lib/x86_64-linux-gnu/samba/libsmbregistry.so.0(smb_panic_s3+0x20) [0x7f2208d7b2b0]
   #2 /usr/lib/x86_64-linux-gnu/libsamba-util.so.0(smb_panic+0x2f) [0x7f2209af28df]
   #3 /usr/lib/x86_64-linux-gnu/libtalloc.so.2(+0x1b5f) [0x7f2206879b5f]
   #4 /usr/lib/x86_64-linux-gnu/libtalloc.so.2(_talloc_free+0x4a5) [0x7f220687a2c5]
   #5 /usr/lib/x86_64-linux-gnu/libsamba-util.so.0(+0x1246c) [0x7f2209ae946c]
   #6 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(+0x18b597) [0x7f2209734597]
   #7 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(+0x18b811) [0x7f2209734811]
   #8 /usr/lib/x86_64-linux-gnu/samba/libdbwrap.so.0(+0x51ed) [0x7f2203d401ed]
   #9 /usr/lib/x86_64-linux-gnu/libtdb.so.1(+0x8745) [0x7f2200aed745]
   #10 /usr/lib/x86_64-linux-gnu/libtdb.so.1(tdb_parse_record+0x6c) [0x7f2200ae8edc]
   #11 /usr/lib/x86_64-linux-gnu/samba/libdbwrap.so.0(+0x5559) [0x7f2203d40559]
   #12 /usr/lib/x86_64-linux-gnu/samba/libdbwrap.so.0(dbwrap_parse_record+0x1b) [0x7f2203d3ddbb]
   #13 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(fetch_share_mode_unlocked+0x54) [0x7f2209735484]
   #14 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(get_file_infos+0x60) [0x7f220972e450]
   #15 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_dirptr_get_entry+0x738) [0x7f2209657188]
   #16 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_dirptr_lanman2_entry+0x1c5) [0x7f220968b095]
   #17 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(+0x140fc0) [0x7f22096e9fc0]
   #18 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_smb2_request_process_query_directory+0x2e4) [0x7f22096ea634]
   #19 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_smb2_request_dispatch+0xcad) [0x7f22096d7e8d]
   #20 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_smb2_request_dispatch_immediate+0x75) [0x7f22096d8355]
   #21 /usr/lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_immediate+0xd4) [0x7f220666d584]
   #22 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(run_events_poll+0x3c) [0x7f2207a1382c]
   #23 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(+0x25b14) [0x7f2207a13b14]
   #24 /usr/lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x8d) [0x7f220666cd5d]
   #25 /usr/lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_wait+0x1b) [0x7f220666cefb]
   #26 /usr/lib/x86_64-linux-gnu/samba/libsmbd-base.so.0(smbd_process+0x6c9) [0x7f22096c71f9]
   #27 smbd(+0x96b6) [0x7f220a18c6b6]
   #28 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(run_events_poll+0x16c) [0x7f2207a1395c]
   #29 /usr/lib/x86_64-linux-gnu/libsmbconf.so.0(+0x25bb0) [0x7f2207a13bb0]
   #30 /usr/lib/x86_64-linux-gnu/libtevent.so.0(_tevent_loop_once+0x8d) [0x7f220666cd5d]
   #31 /usr/lib/x86_64-linux-gnu/libtevent.so.0(tevent_common_loop_wait+0x1b) [0x7f220666cefb]
   #32 smbd(main+0x15b4) [0x7f220a18a6c4]
   #33 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f22062c5ec5]
   #34 smbd(+0x7a96) [0x7f220a18aa96]
[2018/01/17 15:36:53.937918,  0] ../source3/lib/util.c:801(smb_panic_s3)
  smb_panic(): calling panic action [/usr/share/samba/panic-action 17424]
[2018/01/17 15:36:53.940202,  0] ../source3/lib/util.c:809(smb_panic_s3)
  smb_panic(): action returned status 0
[2018/01/17 15:36:53.940269,  0] ../source3/lib/dumpcore.c:303(dump_core)
  dumping core in /var/log/samba/cores/smbd

每次访问失败都会留下这样一段log,发现重点在于

[2018/01/17 15:36:53.937061, 0] ../source3/lib/popt_common.c:68(popt_s3_talloc_log_fn)

  Bad talloc magic value - access after free
[2018/01/17 15:36:53.937073, 0] ../source3/lib/util.c:789(smb_panic_s3)
PANIC (pid 17424): Bad talloc magic value - access after free

Google了一下关键字,居然有人遇到相同的问题并给出了解答

原因是talloc的版本不匹配导致的!安装 libtalloc解决,apt-get install libtalloc2

网管之路漫漫,尽早撒手是王道

虽然刀片服务器摸起来感觉真的很酷,满满科技的质感☆ω☆

Comments
Write a Comment
'