ubuntu下的proftpd字符编码解决

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
skyone
帖子: 37
注册时间: 2006-04-15 15:58
送出感谢: 0
接收感谢: 0

ubuntu下的proftpd字符编码解决

#1

帖子 skyone » 2008-06-29 15:24

ubuntu安装了proftpd ,因为ubuntu默认服务器编码是utf-8 ,而所有windows的ftp客户端都默认使用gbk或是gb2312编码,所以导致服务器上正常的中文文件名,在客户端上看起来都是乱码;而用户通过这些客户端在服务器上建立的看起来正常的中文文件名,在服务器上看起来又是乱码了。
google了一下,未果, 基本都是要求windows客户端换成某种可强行utf8的ftp软件,不现实且不灵活。看到有一个rc版,里面的news提到了一个UseEncoding参数,提及到了相关这方面的问题,于是下载测试,完全OK。
下载:
Candidate: 1.3.2rc1
[ RELEASE_NOTES ]
[ NEWS ] [ gz ] [ bz2 ]

安装:
sudo mv proftpd-1.3.2rc1.tar.gz /usr/local
cd /usr/local
sudo tar zxvf xxxx.tar.gz
cd proftp-1.3.2rc1
sudo ./configure --prefix=/usr/local/proftpd --enable-autoshadow --enable-auth-pam -enable-dso --enable-nls --enable-shadow --disable-ipv6
sudo make
sudo make install

配置:
sudo vi /usr/local/proftpd/etc/proftpd.conf

在 以下你需要配置的区间"server config", , 里面加上UseEncoding UTF-8 GBK
保存,退出,重启动proftpd ,测试 ,搞定

官方文档:
UseEncoding

Syntax: UseEncoding on|off|local-charset client-charset
Default: None
Context: "server config", ,
Module: mod_lang
Compatibility: 1.3.2rc1

The UseEncoding directive is used to explicit configure which character
sets should be used for encoding. By default, the mod_lang will
automatically discover the local character set, and will use UTF8 for
the client character set. The module will also allow the use of UTF8
encoding to be changed by clients using the OPTS UTF8 command (as per
RFC2640). However, if the UseEncoding directive is explicitly used to
indicate the character sets to use (or not use), then any OPTS UTF8
commands used by clients will be refused.

For example, to disable all use of encoding, use the following in your
proftpd.conf:
UseEncoding off

Similarly, to enable use of UTF8 encoding and to not allow clients to
change the use of UTF8, you would use:
UseEncoding on

In addition to the on|off parameters, the UseEncoding directive allows
administrators to specify exactly which character sets to use locally
(i.e. for paths on local disks) and for dealing with clients. One such
usage this way might look like:
UseEncoding koi8-r cp1251

For a full list of the character sets which are supported, use:
$ iconv --list
ladgj
帖子: 10
注册时间: 2012-01-19 0:14
送出感谢: 0
接收感谢: 0

Re: ubuntu下的proftpd字符编码解决

#2

帖子 ladgj » 2013-06-09 12:35

:em11 解决问题了,谢谢!
回复

回到 “服务器基础应用”