samba中文乱码解决

步骤一:查看系统编码

[root@localhost public]# locale
 LANG=zh_CN.UTF-8
 LC_CTYPE="zh_CN.UTF-8"
 LC_NUMERIC="zh_CN.UTF-8"
 LC_TIME="zh_CN.UTF-8"
 LC_COLLATE="zh_CN.UTF-8"
 LC_MONETARY="zh_CN.UTF-8"
 LC_MESSAGES="zh_CN.UTF-8"
 LC_PAPER="zh_CN.UTF-8"
 LC_NAME="zh_CN.UTF-8"
 LC_ADDRESS="zh_CN.UTF-8"
 LC_TELEPHONE="zh_CN.UTF-8"
 LC_MEASUREMENT="zh_CN.UTF-8"
 LC_IDENTIFICATION="zh_CN.UTF-8"
 LC_ALL=

步骤二:修改smb.conf配置文件

根据步骤一来判断,
如果locale是zh_CN.UTF-8,做如下设置:

display charset = utf8

unix charset = utf8

dos charset = utf8

如果locale是zh_CN.GBK或zh_CN.gb2312,做如下设置:

display charset = cp936

unix charset = cp936

dos charset = cp936

步骤三:重启samba服务

service samba restart