samba中文乱码问题 常用的配置

来源:互联网 发布:ecshop商城源码下载 编辑:程序博客网 时间:2024/06/14 07:03
samba中文乱码问题终极篇
2007年11月06日 星期二 10:15
环境:redhat as 3 up 3

vi /etc/samba/smb.conf

根据locales的设置,修改该文件:

1. 如果locale是zh_CN.UTF-8,做如下设置:

display charset = utf8

unix charset = utf8

dos charset = utf8

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

display charset = cp936

unix charset = cp936

dos charset = cp936

重启samba:

service samba restart

则无论从windows的网上邻居,还是直接用securecrt登陆,均可显示正常中文。

通常使用samba来与windows进行文件共享。下面是常用场景的配置和一些问题。
无需密码,直接访问linux上的共享文件夹/home/xx/share:
修改/etc/samba/smb.conf文件,;这其中最重要的是security = share [...]
[global]
workgroup = home
netbios name = xxcomputer
server string = xxcomputer’s share
security = share
[share]
path = /home/xx/share
writeable = yes
browseable = yes
guest ok = yes
[www]
      comment = www
      path = /var/www/html
      public = yes
      writable = yes
     ; printable = no
     ; write list = +staff
      valid users =root
       admin user=root
      write list = root
      create mask = 0770
      directory mask = 0770
[dl]
      comment = www-dl
      path = /var/www/html/dl
      public = yes
      writable = yes
     ; printable = no
     ; write list = +staff
      valid users =media
      admin user=media
      write list = media
      create mask = 0770
      directory mask = 0770