Vsftpd + Mysql + Pam Configuration for the correct version

Source: Internet
Author: User
Article Title: Vsftpd + Mysql + Pam with the correct version to configure virtual users. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

VSFTPD is a secure and fast FTP server in UNIX/Linux and has been used by many large websites. VSFTPD supports saving user names and passwords in database files or database servers. VSFTPD calls this form of user as a virtual user. Compared with FTP local (system) users, virtual users are only dedicated users of the FTP server. Virtual users can only access the resources provided by the FTP server, which greatly enhances the security of the system. Compared with anonymous users, a virtual user requires a user name and password to obtain files on the FTP server. This increases the manageability of users and downloads. For FTP sites that require the download service, but do not require everyone to download them anonymously, you need to manage the download users and take into account host security and convenient management, virtual users are an excellent solution. This article describes how to save the virtual user name and password of VSFTPD on RedHat Linux 9 on the MySQL database server.

  I. VSFTPD Installation

Currently, the latest version of VSFTPD is 1.2.0. The official website is ftp://vsftpd.beasts.org/users/cevans/vsftpd-1.2.0.tar.gz. Before installation, make the following preparations:

The "nobody" user is required in the default VSFTPD configuration. Add this user to the system. If the user already exists, the useradd command prompts accordingly.

[Root @ hpe45 root] # useradd nobody useradd: user nobody exists

The "/usr/share/empty" directory is required in the default VSFTPD configuration. In the system, if the directory already exists, the mkdir command prompts accordingly.

[Root @ hpe45 root] # mkdir/usr/share/empty/mkdir: cannot create directory '/usr/share/empty': File exists

When VSFTPD provides anonymous FTP services, you need an "ftp" user and a valid anonymous directory.

[Root @ hpe45 root] # mkdir/var/ftp/[root @ hpe45 root] # useradd-d/var/ftp the subsequent operations are useful for the existence of ftp users.

[Root @ hpe45 root] # chown root. root/var/ftp [root @ hpe45 root] # chmod og-w/var/ftp

After the above preparations are completed, we can start to compile the source code. Assume that the downloaded vsftpd-1.2.0.tar.gz file is in the/root directory and run the following command: [root @ hpe45 root] # tar zxvf vsftpd-1.2.0.tar.gz [root @ hpe45 root] # cd vsftpd-1.2.0 [root @ hpe45 vsftpd-1.2.0] # make [root @ hpe45 vsftpd-1.2.0] # make install

The above "make install" Command copies compiled binary files and manuals to the corresponding directory. You may need to manually perform the following replication on rh93. [root @ hpe45 vsftpd-1.2.0] # cp vsftpd/usr/local/sbin/vsftpd [root @ hpe45 vsftpd-1.2.0] # cp vsftpd. conf.5/usr/local/share/man/man5 [root @ hpe45 vsftpd-1.2.0] # cp vsftpd.8/usr/local/share/man/man8

Next, we will copy a simple configuration file for later modification.

[Root @ hpe45 vsftpd-1.2.0] # cp vsftpd. conf/etc [root @ hpe45 vsftpd-1.2.0] # cp RedHat/vsftpd. pam/etc/pam. d/ftp copy the PAM Authentication file to allow local users to log on to VSFTPD.

# Cp RedHat/vsftpd. pam/etc/pam. d/ftp

  2. Create a guest user

VSFTPD uses PAM to verify virtual users. Because the user name/password of a virtual user is saved separately, during verification, VSFTPD needs to use the identity of a system user to read database files or database servers for verification, this is the guest user of VSFTPD. This is just like Anonymous Users also need a system user ftp. Of course, we can also regard the guest user as the representative of the virtual user in the system. Add the vsftpdguest user to the system as the guest of VSFTPD.

[Root @ hpe45 vsftpd-1.2.0] # useradd vsftpdguest when a virtual user logs on, the location is the home directory of vsftpdguest/home/vsftpdguest. To log on to other directories such as/var/ftp, modify the vsftpdguest directory.

  3. Set the VSFTPD configuration file

In the/etc/vsftpd. conf file, add the following options: guest_enable = YES guest_username = vsftpdguest

Run the following command to run VSFTPD in the background: [root @ hpe45 vsftpd-1.2.0] #/usr/local/sbin/vsftpd &

[1] [2] Next page

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.