centos下的samba共享檔案在windows下開啟沒有許可權
阿新 • • 發佈:2019-02-08
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = share
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
[share]
comment = Samba server's share
locking = no
writable = yes
browseable = yes
path = /home/share/
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = share
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
[share]
comment = Samba server's share
locking = no
writable = yes
browseable = yes
path = /home/share/
valid user = linux
上面設定好之後重啟samba服務,(/etc/init.d/smb restart)
然後設定selinux:
確保setlinux關閉,用setenforce 0命令執行。 預設的,SELinux禁止網路上對Samba伺服器上的共享目錄進行寫操作,即使你在smb.conf中允許了這項操作。
getenforce 檢視selinux狀態為Permissive就行了(具體的selinux設定方式百度吧!)
然後在windows下登陸共享目錄,如果仍然麼有許可權可以將你的使用者新增的smb賬戶中
smbpasswd命令的常用方法 smbpasswd -a 增加使用者(要增加的使用者必須以是系統使用者) smbpasswd -d 凍結使用者,就是這個使用者不能在登入了 smbpasswd -e 恢復使用者,解凍使用者,讓凍結的使用者可以在使用 smbpasswd -n 把使用者的密碼設定成空. 要在global中寫入 null passwords -true smbpasswd -x 刪除使用者
如果新增完仍然不行就修改一下檔案的許可權,可能是因為你是普通使用者登入的但是檔案時用超級使用者建立的。