RedhatLinux vsftpd compilation and Installation

Source: Internet
Author: User
Article Title: vsftpd compilation and installation on RedhatLinux. 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.

Log on to RedHat bashshell as the root account

[Root @ redhat ~] # Tar-zxvf vsftpd-2.0.5.tar.gz // extract the vsftp source file

[Root @ redhat ~] # Cd vsftpd-2.0.5 // enter the decompressed directory

[Root @ redhat vsftpd-2.0.5] # more INSTALL // check the installation instructions. For example, what to do. Is an English document.

[Root @ redhat vsftpd-2.0.5] # useradd nobody // Add a nobody user here. You can use finger nobody to view the information. Check whether this user exists. You do not need to add

[Root @ redhat vsftpd-2.0.5] # mkdir/usr/share/empty // this step is the same as above. The server requires an empty directory of empty to be placed under/usr/share. You can use ls/usr/share/empty to view the information. This is not required if it exists. You can skip this step.

To enable Anonymous user access, perform the following steps:

[Root @ redhat vsftpd-2.0.5] # mkdir/var/ftp // create a directory for anonymous users

[Root @ redhat vsftpd-2.0.5] # useradd-d/var/ftp // create an ftp user and specify the home directory as/var/ftp, which is also common in this step. If you create a user ftp exists (an FTP user exists), the user already exists.

Continue to the next step

[Root @ redhat vsftpd-2.0.5] # chown root. root/var/ftp // set/var/ftp, that is, the home directory group and owner of the ftp user are root for security. This step is required.

[Root @ redhat vsftpd-2.0.5] # chmod og-w/var/ftp // Change permissions, remove the write permissions for the Group and others

The above writing is finished. Below we can be cheaper

[Root @ redhat vsftpd-2.0.5] # make // compile a binary file

[Root @ redhat vsftpd-2.0.5] # make install // installation, you can see the installation related files.

[Root @ redhat vsftpd-2.0.5] # cp vsftpd. conf/etc // copy the configuration file

[Root @ redhat vsftpd-2.0.5] # cp RedHat/vsftpd. pam/etc/pam. d/ftp // copy PAM security verification file this is the directory where the verification file is located

[Root @ redhat vsftpd-2.0.5] # vi/etc/vsftpd. conf

Then press and jump to the end of the line. Set pam_server_name = ftp (to be the same as your PAM file); userlist_enable = YES (users in the user list cannot log on to the server ). Then, wq is saved and exited.

[Root @ redhat vsftpd-2.0.5] # cp vsftpd. conf.5/usr/local/man/man5

[Root @ redhat vsftpd-2.0.5] # cp vsftpd.8/usr/local/man/man8

Here is the basics. All work is done. But let's talk about something.

By default, vsftp runs as a super daemon (xinetd.

Startup Mode (two methods)

[Root @ redhat vsftpd-2.0.5] # service xinetd restart // restart the super daemon is equivalent to starting vsftp

Another way is to modify the configuration file for independent running.

[Root @ redhat vsftpd-2.0.5] # vi/etc/vsftpd. conf

Then press and jump to the end of the line. Add listen = YES. Then: wq save and exit

In this way, you can use the following statement to start

[Root @ redhat vsftpd-2.0.5] #/usr/local/sbin/vsftpd & // start vsftp in the background

[Root @ redhat vsftpd-2.0.5] # echo "/usr/local/sbin/vsftpd &">/etc/rc. local // append to the Startup Script

The above two methods can be used at will. I also did some experiments on the startup script (started in service vsftpd start mode) and eventually failed. But I want to say. I tried. I am not familiar with shell programming. Failed to write a script for use. Learn! There may be some solutions. Install a vsftp using RPM, and then see how the script in init. d is written.

Next I will post an article about configuration by someone else.

# Anonymous Users

Anonymous_enable = NO

# Anon_mkdir_write_enable = YES

# Anon_upload_enable = YES

# Can a local user log on?

# Local_enable = YES

# Whether it is writable

Write_enable = YES

# VSFTPD independent operation (vsftpd/etc/vsftpd. conf &) and download speed restrictions

Listen = YES

Max_clients = 600

Max_per_ip = 5

Tcp_wrappers = YES

Connect_from_port_20 = YES

# Anon_max_rate = 51200 (56 k)

# Local_max_rate = 512000 (560 k)

# How to change the path

# Anon_root =/var/ftp/pub

# Local_root =/var/ftp

# How to add a user directory at will

Use useradd-d/path/dir-M name and chmod? /Path/dir can be reached

# How to limit a disk

Use quota to restrict/etc/fstab and then restrict specific users.

Supplement:

I. How to restrict users to the home directory?

We need to create a file on our own in the/etc directory.

# Touch/etc/vsftpd. chroot_list

Take the user beinan as an example.

Add beinan to the vsftpd. chroot_list file.

Modify the/etc/vsftpd. conf file and find the following two lines:

# Chroot_list_enable = YES

# Chroot_list_file =/etc/vsftpd. chroot_list

Remove the # above, that is

Chroot_list_enable = YES

Chroot_list_file =/etc/vsftpd. chroot_list

If there are no such two rows, you can add them by yourself.

After the configuration, restart the vsFTPD server.

Supplement 2: Enable the log function of the vsFTP Server:

Correct # In Front Of xferlog_file below, that is, enable the log function of vsftp, so that we can view vsftpd in the/var/log directory. log. this is the log function of vsFTP, which is extremely important for us.

# Xferlog_file =/var/log/vsftpd. log

Supplement 3: How can I bind an IP address to vsFTP? That is to say, how to allow users to access FTP only through an IP address is very interesting. If you are bound to an intranet IP address, there is no way to access the outside. If the IP address of the external service is bound, the Intranet can only access the FTP through the IP address of the external service.

In/etc/vsftpd. add a line in the conf file. Take my local network as an example. Please refer to the operating environment in the first post, so that the Internet will not be able to access my FTP, and the Intranet may also access FTP through 192.168.0.2.

Listen_address = 192.168.0.2

Restart the vsFTP server.

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.