/etc/samba/smb.conf的配置如下:
#============================ Share Definitions ============================== [homes] comment = Home Directories browseable = no writable = yes valid users = %S valid users = MYDOMAIN\%S [printers] comment = All Printers path = /var/spool/samba browseable = no guest ok = no writable = no printable = yes [Downloads] public = yes comment = Share with windows path = /home/leng/Downloads browseable = yes guest ok = yes writable = yes
在命令行添加可訪問的用戶
# smbpasswd -a leng
輸入密碼后在windows上訪問,發現可以登陸到samba服務器並且能夠看到共享文件夾,但是無法進入該文件夾,如下:
解決方法:(該方法在/etc/samba/smb.conf中有提到)
# Set SELinux labels only on files and directories you have created. Use the
# chcon command to temporarily change a label:
# chcon -t samba_share_t /path/to/directory
所以執行以上命令:
#chcon -t samba_share_t /path/to/directory
即可解決問題