安装samba服务器
1.实验目的
(1)了解SMB和NETBIOS的基本原理
(2)掌握Windows和Linux之间,Linux系统之间文件共享的基本方法。
2.实验内容
(1)安装samba服务器。
(2)配置samba服务器的安全级别为用户级。
(3)配置用户的共享。
(4)测试Windows和Linux之间的文件共享。
(5)测试Linux用户之间的文件共享。
3.实验环境
(1)高档PC
(2)Windows 10操作系统
(3)VMware15
(4)CentOS-7x86_64
4.实验过程
(1)按照附录1完成网络配置
(2)安装samba文件
- 检测系统内部是否已经安装好samba文件
#rpm –qa | grep samba
- 如果显示类似如下的版本信息,则证明系统内已经安装好 samba 服务
- 如果没有提示上述信息,则要安装对应的包。
# yum install samba
(3)指定samba在开机启动
# systemctl enable smb
(4)配置/etc/samba/smb.conf配置文件
- 利用vi文本编辑器打开配置文件/etc/samba/smb.conf
# vi /etc/samba/smb.conf
- 配置 global 全局变量区域(只需要找到相应的变量修改即可,如果该变量所在的行用分号“;”注释掉,则将分号去掉。没有该变量就手动添加)
[global] security = user ;文档中存在多个 security 变量,只需其中一个有效即可。 workgroup = wyu :配置文件中所有等号前后加一个空格 netbios name = linux ;建议采用 linux+学号的方式,比如 linux25 ;调试日志 log file = /var/log/samba/smbd.log log level = 2 ; 一共有 10 个级别,2 是 LOG_NOTICE,3 是 LOG_INFO max log size = 50 ; 日志文件最大大小,单位 KB
(5)设置文件共享
- 设置Linux普通用户宿主目录文件共享(配置文件的默认设置)
[homes] comment = Home Directories #对 homes 的注释,以下略写 browserable = No writable = Yes
- 设置匿名用户目录(在配置文件中最后的地方添加即可)
[tmp] path = /tmp read only = No public = Yes
- 设置用户组share的共享目录(在配置文件中最后的地方添加即可)
[share] read list = @share write list = @share public = No browseable = Yes writable = Yes create mask = 0664 directory mask = 0770 path=/home/share
- 保存该文本文件,重启 samba 服务
# systemctl restart smb
- 新建组 share,新建用户 mary,john 和 guest
# useradd mary # passwd mary # useradd john # passwd john # useradd guest # passwd guest
- 新建组 share,并且将用户 mary 和 john 加入 share 组中
# groupadd share # usermod -G share mary # usermod -G share john
将 mary,john,guest 加入到 smbpasswd 文件
# smbpasswd -a mary # smbpasswd -a john # smbpasswd -a guest
在/home 目录下新建目录 share,将其组属性改成 share 组
# mkdir -p /home/share # chown .share /home/share 注意:第一个 share 前有一个“.” # chmod 770 /home/share
重新启动服务
systemctl restart smb.service
(6)Windows 和 Linux 互联测试
(6.1)禁用 SeLinux(实验 1-5 均需要禁用 SElinux)
- 先测试 Selinux 的设置,如果处于 Enforcing 状态,修改为 permissive 或者 disabled。具体如下:
# getenforce
- 如果输出“Enforcing”,则输入下面的命令
# setenforce 0
(6.2) 禁用防火墙 firewalld(实验 1-5 均需要禁用 firewalld)
- 先查看防火墙的运行状态
# systemctl is-active firewalld.service
- 输出 active(活跃),inactive(不活跃)
- 若处于 active 状态,则禁用。
# systemctl stop firewalld.service
以上(6.1)(6.2)两个命令重启后无效,需要重新设置。
(6.3)通过 Linux 客户端访问 Linux 服务器共享文件,则先在 Linux 的控制台上输入如下命令查看主机 172.16.50.1 的共享信息
# smbclient -L //172.16.99.1 -U mary
若要访问share目录,则输入如下命令:
# smbclient -c ls //172.16.99.1/share -U mary
(6.4)通过 Windows 访问 Linux
右击“我的电脑”,左键单击映射网络驱动器,在文件夹方框内按如下格式填写\\172.16.99.1\share ,如下图所示。(假设 172.16.99.1 是Linux服务器的地址)
(7)使用 smbmount 命令挂载远程共享
(7.1)创建挂载点
# mkdir -p /mnt/smb/win
(7.2)将远程共享 share 挂载到本地 /mnt/smb/win 目录
# mount.cifs -o user=mary //172.16.99.1/share /mnt/smb/win/
(7.3)进入挂载点
(7.4)用 mount 命令查看挂装表的内容
# mount
(7.5)用 mount 命令查看挂装表的内容
5.实验的总结
除了安装samba包之外,还需要安装samba-client和cifs
smb.conf
# See smb.conf.example for a more detailed config file or # read the smb.conf manpage. # Run 'testparm' to verify the config is correct after # you modified it. [global] workgroup = wyu security = user netbios name = linux40 log file = /var/log/samba/smbd.log log level = 2 max log size = 50 passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw [homes] comment = Home Directories valid users = %S, %D%w%S browseable = No read only = No inherit acls = Yes writable = Yes [printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @printadmin root force group = @printadmin create mask = 0664 directory mask = 0775 [tmp] path = /tmp read only = No public = Yes [share] read list = @share write list = @share public = No browseable = Yes writable = Yes create mask = 0664 directory mask = 0770 path = /home/share
smb.log
[2020/10/11 14:30:06.917095, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 14:30:06.917159, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 14:30:06.917195, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 14:30:06.917237, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 14:30:06.917267, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 14:30:06.918513, 2] ../../source3/lib/interface.c:345(add_interface) added interface ens33 ip=172.16.40.1 bcast=172.16.40.255 netmask=255.255.255.0 [2020/10/11 14:30:06.918542, 2] ../../source3/lib/interface.c:345(add_interface) added interface ens37 ip=192.168.91.128 bcast=192.168.91.255 netmask=255.255.255.0 [2020/10/11 14:30:06.918551, 2] ../../source3/lib/interface.c:345(add_interface) added interface virbr0 ip=192.168.122.1 bcast=192.168.122.255 netmask=255.255.255.0 [2020/10/11 14:30:06.920959, 1] ../../source3/profile/profile.c:51(set_profile_level) INFO: Profiling turned OFF from pid 2970 [2020/10/11 14:30:06.921843, 2] ../../source3/passdb/pdb_interface.c:161(make_pdb_method_name) No builtin backend found, trying to load plugin [2020/10/11 14:30:06.945047, 2] ../../lib/tdb_wrap/tdb_wrap.c:64(tdb_wrap_log) tdb(/var/lib/samba/registry.tdb): tdb_open_ex: could not open file /var/lib/samba/registry.tdb: 没有那个文件或目录 [2020/10/11 14:30:06.958458, 2] ../../lib/tdb_wrap/tdb_wrap.c:64(tdb_wrap_log) tdb(/var/lib/samba/account_policy.tdb): tdb_open_ex: could not open file /var/lib/samba/account_policy.tdb: 没有那个文件或目录 [2020/10/11 14:30:06.958579, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 1 (min password length), returning 0 [2020/10/11 14:30:06.958596, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 2 (password history), returning 0 [2020/10/11 14:30:06.958605, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 3 (user must logon to change password), returning 0 [2020/10/11 14:30:06.958613, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 4 (maximum password age), returning 0 [2020/10/11 14:30:06.958620, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 5 (minimum password age), returning 0 [2020/10/11 14:30:06.958627, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 6 (lockout duration), returning 0 [2020/10/11 14:30:06.958634, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 7 (reset count minutes), returning 0 [2020/10/11 14:30:06.958641, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 8 (bad lockout attempt), returning 0 [2020/10/11 14:30:06.958648, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 9 (disconnect time), returning 0 [2020/10/11 14:30:06.958655, 2] ../../source3/passdb/account_pol.c:355(account_policy_get) account_policy_get: tdb_fetch_uint32_t failed for type 10 (refuse machine password change), returning 0 [2020/10/11 14:30:06.962536, 1] ../../source3/passdb/pdb_tdb.c:543(tdbsam_open) tdbsam_open: Converting version 0.0 database to version 4.0. [2020/10/11 14:30:06.962710, 1] ../../source3/passdb/pdb_tdb.c:304(tdbsam_convert_backup) tdbsam_convert_backup: updated /var/lib/samba/private/passdb.tdb file. [2020/10/11 14:30:06.962753, 2] ../../source3/lib/util_tdb.c:279(tdb_log) tdb(/var/lib/samba/winbindd_idmap.tdb): tdb_open_ex: could not open file /var/lib/samba/winbindd_idmap.tdb: 没有那个文件或目录 [2020/10/11 14:30:06.969814, 0] ../../lib/util/become_daemon.c:136(daemon_ready) daemon_ready: daemon 'smbd' finished starting up and ready to serve connections [2020/10/11 14:30:06.992873, 1] ../../source3/printing/printer_list.c:234(printer_list_get_last_refresh) Failed to fetch record! [2020/10/11 14:30:06.993069, 2] ../../source3/smbd/server.c:1415(smbd_parent_loop) waiting for connections [2020/10/11 14:30:07.003805, 2] ../../lib/util/tevent_debug.c:66(samba_tevent_debug) samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x55c024d44cd0] mpx_fde[(nil)] fd[16] - disabling [2020/10/11 14:42:37.104664, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3193 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:42:37.104795, 2] ../../lib/util/tevent_debug.c:66(samba_tevent_debug) samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x55c024d44cd0] mpx_fde[(nil)] fd[16] - disabling [2020/10/11 14:45:07.002966, 2] ../../source3/smbd/server.c:837(remove_child_pid) Could not find child 3358 -- ignoring [2020/10/11 14:50:23.242144, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 14:50:23.242243, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 14:50:23.242281, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 14:50:23.242322, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 14:50:23.242364, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 14:50:23.243629, 2] ../../source3/lib/interface.c:345(add_interface) added interface ens33 ip=172.16.40.1 bcast=172.16.40.255 netmask=255.255.255.0 [2020/10/11 14:50:23.243657, 2] ../../source3/lib/interface.c:345(add_interface) added interface ens37 ip=192.168.91.128 bcast=192.168.91.255 netmask=255.255.255.0 [2020/10/11 14:50:23.243665, 2] ../../source3/lib/interface.c:345(add_interface) added interface virbr0 ip=192.168.122.1 bcast=192.168.122.255 netmask=255.255.255.0 [2020/10/11 14:50:23.246253, 1] ../../source3/profile/profile.c:51(set_profile_level) INFO: Profiling turned OFF from pid 3770 [2020/10/11 14:50:23.246986, 2] ../../source3/passdb/pdb_interface.c:161(make_pdb_method_name) No builtin backend found, trying to load plugin [2020/10/11 14:50:23.267425, 0] ../../lib/util/become_daemon.c:136(daemon_ready) daemon_ready: daemon 'smbd' finished starting up and ready to serve connections [2020/10/11 14:50:23.286645, 1] ../../source3/printing/printer_list.c:234(printer_list_get_last_refresh) Failed to fetch record! [2020/10/11 14:50:23.286713, 2] ../../source3/smbd/server.c:1415(smbd_parent_loop) waiting for connections [2020/10/11 14:50:23.303029, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 2972 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:50:23.303647, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 2973 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:50:23.304144, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3364 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:50:23.304325, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3414 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:50:23.304575, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3479 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:50:23.304669, 2] ../../lib/util/tevent_debug.c:66(samba_tevent_debug) samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x557d7162b1a0] mpx_fde[(nil)] fd[16] - disabling [2020/10/11 14:56:11.602732, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 14:56:11.602796, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 14:56:11.602863, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 14:56:11.602908, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 14:56:11.602936, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 14:56:11.603894, 2] ../../source3/lib/interface.c:345(add_interface) added interface ens33 ip=172.16.40.1 bcast=172.16.40.255 netmask=255.255.255.0 [2020/10/11 14:56:11.603921, 2] ../../source3/lib/interface.c:345(add_interface) added interface ens37 ip=192.168.91.128 bcast=192.168.91.255 netmask=255.255.255.0 [2020/10/11 14:56:11.603930, 2] ../../source3/lib/interface.c:345(add_interface) added interface virbr0 ip=192.168.122.1 bcast=192.168.122.255 netmask=255.255.255.0 [2020/10/11 14:56:11.605999, 1] ../../source3/profile/profile.c:51(set_profile_level) INFO: Profiling turned OFF from pid 4258 [2020/10/11 14:56:11.606700, 2] ../../source3/passdb/pdb_interface.c:161(make_pdb_method_name) No builtin backend found, trying to load plugin [2020/10/11 14:56:11.623183, 0] ../../lib/util/become_daemon.c:136(daemon_ready) daemon_ready: daemon 'smbd' finished starting up and ready to serve connections [2020/10/11 14:56:11.638204, 1] ../../source3/printing/printer_list.c:234(printer_list_get_last_refresh) Failed to fetch record! [2020/10/11 14:56:11.638272, 2] ../../source3/smbd/server.c:1415(smbd_parent_loop) waiting for connections [2020/10/11 14:56:11.656495, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 2972 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:56:11.656902, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 2973 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:56:11.657209, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3364 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:56:11.657404, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3414 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:56:11.657595, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3479 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:56:11.657622, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3772 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:56:11.657643, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3773 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 14:56:11.657731, 2] ../../lib/util/tevent_debug.c:66(samba_tevent_debug) samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x5601900371a0] mpx_fde[(nil)] fd[16] - disabling [2020/10/11 15:08:35.849748, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 15:08:35.850320, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 15:08:35.850365, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 15:08:35.850412, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 15:08:35.850442, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 15:08:35.853937, 2] ../../source3/auth/auth.c:316(auth_check_ntlm_password) check_ntlm_password: authentication for user [mary] -> [mary] -> [mary] succeeded [2020/10/11 15:08:35.867740, 2] ../../source3/smbd/reply.c:705(reply_special) netbios connect: name1=172.16.40.1 0x20 name2=LINUX40 0x0 [2020/10/11 15:08:35.867830, 2] ../../source3/smbd/reply.c:746(reply_special) netbios connect: local=172.16.40.1 remote=linux40, name type = 0 [2020/10/11 15:08:35.870811, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 15:08:35.870866, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 15:08:35.870899, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 15:08:35.870936, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 15:08:35.870960, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 15:08:35.871498, 2] ../../source3/auth/auth.c:316(auth_check_ntlm_password) check_ntlm_password: authentication for user [mary] -> [mary] -> [mary] succeeded [2020/10/11 15:08:41.747976, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 2972 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:08:41.748404, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 2973 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:08:41.748795, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3364 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:08:41.749115, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3414 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:08:41.749422, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3479 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:08:41.749645, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3772 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:08:41.749909, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 3773 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:08:41.750552, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 5072 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:08:41.750579, 2] ../../lib/util/tevent_debug.c:66(samba_tevent_debug) samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x5601900371a0] mpx_fde[(nil)] fd[16] - disabling [2020/10/11 15:11:11.685861, 2] ../../source3/smbd/server.c:837(remove_child_pid) Could not find child 5235 -- ignoring [2020/10/11 15:18:23.423523, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 15:18:23.423743, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 15:18:23.423772, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 15:18:23.423808, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 15:18:23.423832, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 15:18:23.424922, 2] ../../source3/auth/auth.c:316(auth_check_ntlm_password) check_ntlm_password: authentication for user [mary] -> [mary] -> [mary] succeeded [2020/10/11 15:18:23.432690, 2] ../../source3/smbd/service.c:851(make_connection_snum) linux40 (ipv4:172.16.40.1:60254) connect to service share initially as user mary (uid=1005, gid=1007) (pid 5696) [2020/10/11 15:18:23.440260, 2] ../../source3/smbd/service.c:1131(close_cnum) linux40 (ipv4:172.16.40.1:60254) closed connection to service share [2020/10/11 15:20:10.973678, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 15:20:10.973965, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 15:20:10.973996, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 15:20:10.974034, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 15:20:10.974058, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 15:20:10.974939, 2] ../../source3/auth/auth.c:316(auth_check_ntlm_password) check_ntlm_password: authentication for user [mary] -> [mary] -> [mary] succeeded [2020/10/11 15:20:10.978012, 2] ../../source3/smbd/service.c:851(make_connection_snum) linux40 (ipv4:172.16.40.1:60256) connect to service share initially as user mary (uid=1005, gid=1007) (pid 5832) [2020/10/11 15:20:10.981980, 2] ../../source3/smbd/service.c:1131(close_cnum) linux40 (ipv4:172.16.40.1:60256) closed connection to service share [2020/10/11 15:21:11.874141, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 5695 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:21:11.874758, 1] ../../source3/lib/messages.c:899(send_all_fn) send_all_fn: messaging_send_buf to 5831 failed: NT_STATUS_OBJECT_NAME_NOT_FOUND [2020/10/11 15:21:11.874788, 2] ../../lib/util/tevent_debug.c:66(samba_tevent_debug) samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x560190037110] mpx_fde[(nil)] fd[16] - disabling [2020/10/11 15:23:21.060082, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 15:23:21.060177, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 15:23:21.060208, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 15:23:21.060245, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 15:23:21.060270, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 15:23:21.060760, 2] ../../source3/auth/auth.c:334(auth_check_ntlm_password) check_ntlm_password: Authentication for user [YANG] -> [YANG] FAILED with error NT_STATUS_NO_SUCH_USER, authoritative=1 [2020/10/11 15:23:21.060809, 2] ../../auth/auth_log.c:647(log_authentication_event_human_readable) Auth: [SMB2,(null)] user [YANGJH]\[YANG] at [日, 11 10月 2020 15:23:21.060793 CST] with [NTLMv2] status [NT_STATUS_NO_SUCH_USER] workstation [YANGJH] remote host [ipv4:172.16.40.100:5710] mapped to [YANGJH]\[YANG]. local host [ipv4:172.16.40.1:445] {"timestamp": "2020-10-11T15:23:21.061222+0800", "type": "Authentication", "Authentication": {"version": {"major": 1, "minor": 1}, "eventId": 4625, "logonType": 3, "status": "NT_STATUS_NO_SUCH_USER", "localAddress": "ipv4:172.16.40.1:445", "remoteAddress": "ipv4:172.16.40.100:5710", "serviceDescription": "SMB2", "authDescription": null, "clientDomain": "YANGJH", "clientAccount": "YANG", "workstation": "YANGJH", "becameAccount": null, "becameDomain": null, "becameSid": null, "mappedAccount": "YANG", "mappedDomain": "YANGJH", "netlogonComputer": null, "netlogonTrustAccount": null, "netlogonNegotiateFlags": "0x00000000", "netlogonSecureChannelType": 0, "netlogonTrustAccountSid": null, "passwordType": "NTLMv2", "duration": 5293}} [2020/10/11 15:23:37.829519, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 15:23:37.829607, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 15:23:37.829636, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 15:23:37.829672, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 15:23:37.829696, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 15:23:37.831404, 2] ../../source3/auth/auth.c:316(auth_check_ntlm_password) check_ntlm_password: authentication for user [mary] -> [mary] -> [mary] succeeded [2020/10/11 15:23:37.840721, 2] ../../source3/smbd/service.c:851(make_connection_snum) yangjh (ipv4:172.16.40.100:5713) connect to service share initially as user mary (uid=1005, gid=1007) (pid 6067) [2020/10/11 15:26:11.718233, 2] ../../source3/smbd/server.c:837(remove_child_pid) Could not find child 6260 -- ignoring [2020/10/11 15:27:37.585791, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 15:27:37.585872, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 15:27:37.585902, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 15:27:37.585938, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 15:27:37.585967, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 15:27:37.587005, 2] ../../source3/auth/auth.c:316(auth_check_ntlm_password) check_ntlm_password: authentication for user [mary] -> [mary] -> [mary] succeeded [2020/10/11 15:27:37.609960, 2] ../../source3/smbd/service.c:851(make_connection_snum) (ipv4:172.16.40.1:60258) connect to service share initially as user mary (uid=1005, gid=1007) (pid 6370) [2020/10/11 15:33:41.937227, 2] ../../lib/util/tevent_debug.c:66(samba_tevent_debug) samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x5601900353e0] mpx_fde[(nil)] fd[16] - disabling [2020/10/11 15:41:11.761800, 2] ../../source3/smbd/server.c:837(remove_child_pid) Could not find child 7264 -- ignoring [2020/10/11 15:44:00.858884, 2] ../../source3/smbd/service.c:1131(close_cnum) (ipv4:172.16.40.1:60258) closed connection to service share [2020/10/11 15:45:46.229500, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[homes]" [2020/10/11 15:45:46.229593, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[printers]" [2020/10/11 15:45:46.229627, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[print$]" [2020/10/11 15:45:46.229662, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[tmp]" [2020/10/11 15:45:46.229684, 2] ../../source3/param/loadparm.c:2803(lp_do_section) Processing section "[share]" [2020/10/11 15:45:46.230623, 2] ../../source3/auth/auth.c:316(auth_check_ntlm_password) check_ntlm_password: authentication for user [mary] -> [mary] -> [mary] succeeded [2020/10/11 15:45:46.233804, 2] ../../source3/smbd/service.c:851(make_connection_snum) (ipv4:172.16.40.1:60260) connect to service share initially as user mary (uid=1005, gid=1007) (pid 7621) [2020/10/11 15:46:11.988168, 2] ../../lib/util/tevent_debug.c:66(samba_tevent_debug) samba_tevent: EPOLL_CTL_DEL EBADF for fde[0x560190036e50] mpx_fde[(nil)] fd[16] - disabling [2020/10/11 15:47:10.780679, 2] ../../source3/smbd/service.c:1131(close_cnum) (ipv4:172.16.40.1:60260) closed connection to service share
- 先查看防火墙的运行状态
- 如果输出“Enforcing”,则输入下面的命令
- 先测试 Selinux 的设置,如果处于 Enforcing 状态,修改为 permissive 或者 disabled。具体如下:
- 新建组 share,并且将用户 mary 和 john 加入 share 组中
- 新建组 share,新建用户 mary,john 和 guest
- 保存该文本文件,重启 samba 服务
- 设置用户组share的共享目录(在配置文件中最后的地方添加即可)
- 设置匿名用户目录(在配置文件中最后的地方添加即可)
- 设置Linux普通用户宿主目录文件共享(配置文件的默认设置)
- 配置 global 全局变量区域(只需要找到相应的变量修改即可,如果该变量所在的行用分号“;”注释掉,则将分号去掉。没有该变量就手动添加)
- 利用vi文本编辑器打开配置文件/etc/samba/smb.conf
- 如果没有提示上述信息,则要安装对应的包。
- 如果显示类似如下的版本信息,则证明系统内已经安装好 samba 服务