我在运行 Samba(3.0.33-3.29)的 CentOS 5.7 盒子上安装了一个新驱动器/New_drive
,并在 fstab 中配置如下:
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
**/dev/VolGroup02/LogVol00 /New_drive ext3 defaults 1 1**
我有两个文件夹已通过 samba 共享和访问。
我让用户 smbuser 在 Windows 计算机上完全访问这些文件夹。smb.conf 文件具有以下配置:
#======================= Global Settings =====================================
[global]
workgroup = lab
server string = Samba-server1
coding system= euc
client code page=932
encrypt passwords=yes
log file = /var/log/samba/%m.log
max log size = 50
security = user
passdb backend = tdbsam
#============================ Share Definitions ==============================
# Samba Files
[share-lab]
comment = Samba-files
create mode=0777
directory mode=0777
path =/home/sambafiles
writable = yes
valid users = smbuser
#Samba backup Files
[Samba-Backup]
comment = Backup
create mode=0777
directory mode=0777
path =/home/sambabackup
writable = yes
valid users = smbuser
因此,将所有者和设置为/New_drive
smbuser,并授予该文件夹的公共访问权限。并在 smb.conf 中添加新行
#New Drive
[New-drive]
comment = New-drive
create mode=0777
directory mode=0777
path =/New_drive/sambafiles
writable = yes
valid users = smbuser
但是,从 Windows 计算机可以看到新驱动器,但无法访问。日志文件记录了错误如下
smbd/service.c:make_connection_snum(1013)
'/New_drive/sambafiles' does not exist or permission denied when connecting to [Ohmi-New] Error was Permission denied
有人能建议我解决这个问题的方法吗?
答案1
听起来好像 SELinux 正在阻止这一点。
这Fedora 维基百科条目有一个关于如何修复此问题的条目。本质上扩展属性SELinux 需要允许非默认的 Samba 共享。
chcon -t samba_share_t /New_drive
semanage fcontext -a -t samba_share_t "/New_drive(/.*)?"
restorecon -R -v /New_drive