/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
即可解决问题。