RedHat. Enterprise. Linux.5.Update. 1 VSFTP + MYSQL failed

Source: Internet
Author: User
Tags crypt
RedHat. Enterprise. Linux.5.Update. 1 VSFTP + MYSQL fail-Linux Enterprise Application-Linux server application information. For details, see the following. First, describe the environment:
OS: RedHat. Enterprise. Linux.5.Update. 1
During installation, only all Development kits and Chinese support packages are selected. installation is in English and there is no graphic interface.
Now I want to use VSFTP for FTP service authentication in the form of MYSQL virtual users.
The windows client can upload files to the FTP server, but the files uploaded are garbled in the LINUX directory. the company uses traditional XP and simplified XP. Can these two systems correctly view Chinese files and directories. I have found a lot of articles on the Internet, but I cannot do it at the end.


Now paste the installation process:
# Mkdir/var/ftp
# Chown root: root/var/ftp/
# Tar-zxvf vsftpd-2.0.6.tar.gz
// Enter the decompressed directory and edit the following files
# Vi builddefs. h
# Ifndef VSF_BUILDDEFS_H
# Define VSF_BUILDDEFS_H
# Undef VSF_BUILD_TCPWRAPPERS
# Define VSF_BUILD_PAM
# Undef VSF_BUILD_SSL
# Endif/* VSF_BUILDDEFS_H */
Change undef in the above file to define, tcp_wrappers is supported, PAM Authentication is supported, and SSL is supported
// Compile
Make
Make install
// Install the vsftp configuration file
# Cp vsftpd. conf/etc/
# Cp RedHat/vsftpd. pam/etc/pam. d/vsftp
// Modify vsftp Parameters
# Vi/etc/vsftpd. conf
Anonymous_enable = NO
Local_enable = YES
Write_enable = YES
Local_umask = 022
Anon_upload_enable = YES
Anon_mkdir_write_enable = YES
Anon_other_write_enable = YES
Chroot_local_user = YES
Guest_enable = YES
Guest_username = ftpd
Listen = YES
Listen_port = 21
Pasv_enable = YES
Pasv_min_port = 30000
Pasvanderbilt max_port = 30999
Anon_world_readable_only = NO
Virtual_use_local_privs = YES
// Start automatically
Extract vsftpd from the RPM package to the/etc/rc. d/init. d/directory.
# Mkdir/etc/vsftpd
# Ln-s/etc/vsftpd. conf/etc/vsftpd. conf
# Ln-s/usr/local/sbin/vsftpd/usr/sbin/vsftpd
# Vi/etc/rc. d/init. d/vsftpd
Change this line to daemon/usr/sbin/vsftpd $ I &
# Chkconfig -- add vsftpd
# Chkconfig -- level 3 vsftpd on
# Chkconfig -- level 5 vsftpd on
Now, you can use service vsftpd start | stop | restart to control vsftpd.
// Add a virtual user
# Useradd-d/home/ftpd-s/sbin/nologin ftpd // The password is 123456
// Install MYSQL
Download:
MySQL-client-community-5.0.51a-0.rhel5.i386.rpm
MySQL-server-community-5.0.51a-0.rhel5.i386.rpm
MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm
MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm
Rea hat disc contains:
Perl-DBI-1.52-1.fc6.i386.rpm
# Rpm-ivh perl-DBI-1.52-1.fc6.i386.rpm
# Rpm-ivh MySQL-client-community-5.0.51a-0.rhel5.i386.rpm
# Rpm-ivh MySQL-server-community-5.0.51a-0.rhel5.i386.rpm
# Rpm-ivh MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm
# Rpm-ivh MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm
No error is reported.
# Usr/bin/mysqladmin-u root password your password
# Mysql? U root-h localhost-p
Mysql>; create database vsftpd;
Mysql>; use vsftpd;
Mysql>; create table users (name char (20) binary, passwd char (20) binary );
Mysql>; insert into users (name, passwd) values ('test1', '123 ');
Mysql>; insert into users (name, passwd) values ('test2', '123 ');
Mysql>; grant select on vsftpd. users to ftpd @ localhost identified by '123 ';
Mysql>; flush privileges;
Mysql>; quit
The ftpd user can read mysql Data. The password and user name are in plaintext.
Install pam_mysql-0.6.2-4.fc6.i386.rpm
# Rpm-ivh pam_mysql-0.6.2-4.fc6.i386.rpm
No error is reported. You can see pam_mysql.so in the/lib/security/directory.
// Set PAM verification for MySQL
Edit/etc/pam. d/vsftpd as follows (only the following content is retained)
# Vi/etc/pam. d/vsftpd
Auth required/lib/security/pam_mysql.so user = ftpd passwd = 123456 host = localhost db = vsftpd table = users
Usercolumn = name passwdcolumn = passwd crypt = 0
Account required/lib/security/pam_mysql.so user = ftpd passwd = 123456 host = localhost db = vsftpd table = users
Usercolumn = name passwdcolumn = passwd crypt = 0
# Wc-l/etc/pam. d/vsftpd
4/etc/pam. d/vsftpd
Test:
Ftp 127.0.0.1
Connected to 127.0.0.1.
220 (vsFTPd 2.0.6)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (127.0.0.1: root): test1
331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
Ftp>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.