Garbled characters occur when accessing the FTP application server on a Windows client. This is because the UTF-8 is not compatible with GBK and cause a headache, the use of source code compilation and installation can solve this problem. Garbled solution: 1. First, use rpm-evsftpd to uninstall the default VSFTPD application server installed in the system: [root @ localhost ~] # Rpm-evsftpd2, from htt
Garbled characters occur when accessing the FTP application server on a Windows client. This is because the UTF-8 is not compatible with GBK and cause a headache, the use of source code compilation and installation can solve this problem.
Garbled code solution process:
1. First, use rpm-e vsftpd to uninstall the default VSFTPD application server installed in the system:
[Root @ localhost ~] # Rpm-e vsftpd
2. from http: // vault.Centos. Org/6.3/updates/Source/SPackages/Web site to download the vsftpd-2.2.2-11.el6_3.1.src.rpm Source package.
3. use the rpm-ivh vsftpd-2.2.2-11.el6_3.1.src.rpm to install the package:
[Root @ localhost birdofprey] # rpm-ivhvsftpd-2.2.2-11.el6_3.1.src.rpm
The following error is prompted during installation.:
Warning: vsftpd-2.2.2-11.el6_3.1.src.rpm: Header V3 RSA/SHA1Signature, key ID c105b9de: NOKEY
1: vsftpd warning: user mockbuild does not exist-using root
######################################## ### [100%]
Warning: user mockbuild does not exist-using root
Warning: group mockbuild does not exist-using root
Warning: user mockbuild does not exist-using root
Warning: group mockbuild does not exist-using root
Warning: user mockbuild does not exist-using root
Warning: group mockbuild does not exist-using root
Use the adduser mockbuild command to create a mockbuild user.:
[Root @ localhost birdofprey] # adduser mockbuild
4. re-use the rpm-ivh vsftpd-2.2.2-11.el6_3.1.src.rpm to install the package:
[Root @ localhost birdofprey] # rpm-ivhvsftpd-2.2.2-11.el6_3.1.src.rpm
Warning: vsftpd-2.2.2-11.el6_3.1.src.rpm: Header V3 RSA/SHA1Signature, key ID c105b9de: NOKEY
1: vsftpd ####################################### #### [100%]
5. run the command cd/root/rpmbuild/SOURCES/vsftpd/SOURCES to enter the vsftpd source code package directory, and use tar -zxvfvsftpd-2.2.2.tar.gzto decompress the vsftpd-2.2.2.tar.gz source code package:
[Root @ localhost SOURCES] # tar-zxvf vsftpd-2.2.2.tar.gz
6, use the command cd vsftdp-2.2.2 to enter the vsfftpd-2.2.2 Source Code Directory:
[Root @ localhost SOURCES] # cd vsftpd-2.2.2
7. run the command vi features. c to modify the features. c file, and set the line content to vsf_cmdio_write_raw (p_sess, "UTF8 \ r \ n ");
Change to: // vsf_cmdio_write_raw (p_sess, "UTF8 \ r \ n ").
8. run the command vi opts. c to modify the opts. c file;
Modify the handle_opts function to the following:
Void
Handle_opts (struct vsf_session * p_sess)
{
Str_upper (& p_sess-> ftp_arg_str );
// If (str_cmd_text (& p_sess-> ftp_arg_str, "UTF8ON "))
//{
// Vsf_cmdio_write (p_sess, FTP_OPTSOK, "Always in UTF8mode .");
//}
// Else
//{
// Vsf_cmdio_write (p_sess, FTP_BADOPTS, "Option notunderstood .");
//}
}
9. return to the upper directory and use tar-zcvf vsftpd-2.2.2.tar.gzvsftpd-2.2.2/command to re-compress the vsftpd-2.2.2.tar.gz file:
[Root @ localhost SOURCES] # tar-zcvf vsftpd-2.2.2.tar.gzvsftpd-2.2.2/
By using the ls-command, we can see that the creation time of the vsftpd-2.2.2.tar.gz file in sequence is already the current creation time, as shown below:
-Rw-r --. 1 mockbuild 186982 August 15: 39vsftpd-2.2.2.tar.gz
-Rw-r --. 1 mockbuild 2828 August 00: 06vsftpd-2.2.2-uint-uidgid.patch
-Rw-r --. 1 mockbuild 1640 August 00: 06vsftpd-2.2.2-v6only.patch
-Rw-r --. 1 mockbuild 514 August 00: 06vsftpd-close-std-fds.patch
-Rwxr-xr-x. 1 mockbuild 338 August 00: 06vsftpd_conf_migrate.sh
-Rw-r --. 1 mockbuild 125: 06vsftpd. ftpusers
-Rwxr-xr-x. 1 mockbuild 2824: 06vsftpd. init
-Rw-r --. 1 mockbuild 335 00:06 vsftpd. pam
-Rw-r --. 1 mockbuild 361 August 00: 06vsftpd. user_list
-Rw-r --. 1 mockbuild 345 August 00: 06vsftpd. xinetd
10. go to the SPECS directory under the source package and use the rpmbuild-bbvsftpd. spec command to generate the vsftpd-2.2.2-11.el6.1.x86_64.rpm:
[Root @ localhost SPECS] # rpmbuild-bb vsftpd. spec
The following error is reported because the system lacks a dependency package:
Error: Failed build dependencies:
Libcap-devel is needed by vsftpd-2.2.2-11.el6.1.x86_64
Tcp_wrappers-devel is needed by vsftpd-2.2.2-11.el6.1.x86_64
We can find the following RPM software package from the CentOS6.4 installation disk for manual installation. the package name is as follows:
Libattr-2.4.44-7.el6.i686.rpmlibcap-devel-2.16-5.5.el6.x86_64.rpm
Libattr-2.4.44-7.el6.x86_64.rpmtcp_wrappers-devel-7.6-57.el6.i686.rpm
Libattr-devel-2.4.44-7.el6.i686.rpmtcp_wrappers-devel-7.6-57.el6.x86_64.rpm
Libattr-devel-2.4.44-7.el6.x86_64.rpmtcp_wrappers-libs-7.6-57.el6.i686.rpm
Libcap-2.16-5.5.el6.i686.rpmtcp_wrappers-libs-7.6-57.el6.x86_64.rpm
Libcap-2.16-5.5.el6.x86_64.rpmvsftpd-2.2.2-11.el6_3.1.src.rpm
Libcap-devel-2.16-5.5.el6.i686.rpm
11. run the rpm-ivh *. rpm-force -- nodeps command to forcibly install the above packages:
[Root @ localhost rpm] # rpm-ivh *. rpm -- force -- nodeps
Warning: libattr-2.4.44-7.el6.i686.rpm: Header V3 RSA/SHA1Signature, key ID c105b9de: NOKEY
Preparing... ######################################## ### [100%]
1: libattr ####################################### #### [8%]
2: libcap ####################################### #### [17%]
3: tcp_wrappers-libs ####################################### #### [25%]
4: libattr ####################################### #### [33%]
5: libcap ####################################### #### [42%]
6: tcp_wrappers-libs ####################################### #### [50%]
7: tcp_wrappers-devel ####################################### #### [58%]
8: libcap-devel ##################################### ###### [67%]
9: libattr-devel ##################################### ###### [75%]
10: tcp_wrappers-devel ####################################### #### [83%]
11: libcap-devel ##################################### ###### [92%]
12: libattr-devel ##################################### ###### [100%]
12. re-compile the vsftpd-2.2.2-11.el6.1.x86_64.rpm package with rpmbuild-bbvsftpd. spec:
[Root @ localhost SPECS] # rpmbuild-bb vsftpd. spec
13. go to the x86_64 Directory. you can see that the RPM package has been generated under this directory:
Command mode:
[Root @ localhost RPMS] # cd x86_64/
[Root @ localhost x86_64] # ls
Vsftpd-2.2.2-11.el6.1.x86_64.rpmvsftpd-debuginfo-2.2.2-11.el6.1.x86_64.rpm
14. reinstall the vsftpd application server package with source code modification:
[Root @ localhost x86_64] # rpm-ivhvsftpd-2.2.2-11.el6.1.x86_64.rpm
Preparing... ######################################## ### [100%]
1: vsftpd ####################################### #### [100%]
15. CentOS6.4 modify the default character set of the system:
[Root @ localhost/] # vi/etc/sysconfig/i18n
Modify the original file to the following:
# LANG = "zh_CN.UTF-8"
LANG = "zh_CN.GB18030"
SUPPORTED = "zh_CN.GB18030: zh_CN: zh: zh_CN.GB2312: en_US.UTF-8: en_US: en"
SYSFONT = "latarcyrheb-sun16"
At this time, all the modifications have been completed. after the FTP application server is restarted, we will use IE browser in windows and the preliminary application software to test Chinese garbled characters. This solution also applies to garbled characters caused by compatibility of VSFTPD on windows client character sets in RHEL6 operating systems.