我按照这些说明在 CentOS 6.3 操作系统和 CentOS 6.5 操作系统上安装 Samba。
http://rbgeek.wordpress.com/2012/05/25/how-to-install-samba-server-on-centos-6/
它似乎只适用于 6.5。我在 6.5 中构建了其中 4 个,并且非常熟悉其设置。当我在 6.3 中执行完全相同的操作时,我无法在 Windows 中查看 UNC 路径 \192.168.245.132\MyShare 中的文件。但我的 4 台 6.5 机器都在我身上。
可能出什么问题了?
这些操作系统的唯一主要区别是 6.3 安装了 Selinux 并且将其设置为“强制”(打开)。所以我禁用了它。在6.5版本中,我安装了它,但默认情况下它是禁用的。
# DISABLE SELINUX (BEFORE ACCESSING UNC PATH ON WINDOWS)
[root@localhost i2b2-1.6]# sudo nano /etc/selinux/config
# OLD VALUE:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
# NEW VALUE:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost i2b2-1.6]# sudo service smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
[root@localhost i2b2-1.6]# sudo service nmb restart
Shutting down NMB services: [ OK ]
Starting NMB services: [ OK ]
[root@localhost i2b2-1.6]#
这是来自 6.5 安全版“MyShare”文件夹(又名 /samba/share/)的图片。
图片来自 6.3 安装。
编辑:
现在这很有趣。我的共享目录 (/samba/share/) 有一个“.” (点)位于 6.3(非工作操作系统)的权限末尾,并且权限位后面有 3。
[root@localhost share]# ls -la
total 12
drwsrwsrwx. 3 root root 4096 May 27 18:42 .
drwxrwxrwx. 3 root root 4096 May 27 17:48 ..
drwxrwxrwx. 6 root root 4096 May 27 19:03 quick_install
共享目录 (/samba/share/) 没有“.” (点)位于 6.5(工作操作系统)的权限末尾,并且权限位后面有一个 4(而不是 3)。
[root@localhost share]# ls -la
total 16
drwxrwxrwx 4 root root 4096 May 22 01:02 .
drwxr-xr-x 3 root root 4096 May 19 00:28 ..
drwsrwsrwt 2 root root 4096 May 23 00:37 certs
drwxr-xr-x 6 root root 4096 May 19 01:05 quick_install
问题是,我该如何删除它。创建此目录后,我必须禁用 Selenix。我该如何解决?
编辑#2:
越来越近。这是一个参考,但并不是 100% 有帮助。
https://superuser.com/questions/191903/how-do-i-remove-any-selinux-context-or-acl
这称为 SELinux ACL,不要与许多足球损伤造成的韧带混淆。唯一的问题是我可能必须重新启动 samba 文件共享并重新启动。但不确定。
[root@localhost share]# setfacl --help
setfacl 2.2.49 -- set file access control lists
Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
-m, --modify=acl modify the current ACL(s) of file(s)
-M, --modify-file=file read ACL entries to modify from file
-x, --remove=acl remove entries from the ACL(s) of file(s)
-X, --remove-file=file read ACL entries to remove from file
-b, --remove-all remove all extended ACL entries
-k, --remove-default remove the default ACL
--set=acl set the ACL of file(s), replacing the current ACL
--set-file=file read ACL entries to set from file
--mask do recalculate the effective rights mask
-n, --no-mask don't recalculate the effective rights mask
-d, --default operations apply to the default ACL
-R, --recursive recurse into subdirectories
-L, --logical logical walk, follow symbolic links
-P, --physical physical walk, do not follow symbolic links
--restore=file restore ACLs (inverse of `getfacl -R')
--test test mode (ACLs are not modified)
-v, --version print version and exit
-h, --help this help text
[root@localhost share]#