Install vsftpd and vsftpd in linux

Source: Internet
Author: User
Tags ftp connection ftp access
This article describes how to install vsftpd and vsftpd in linux. For more information, see VSFTP.

Step 1: Download the RPM Package of vsftpd

You can get the latest vsftpd RPM package Redhat's rpm collection or rpmfind.net from the following two places. for your convenience, you can also use wget to download the vsftpd rpm package from this site to your local computer.

Copy codeThe code is as follows:
Wget http://www.vsftpdrocks.org/vsftpd-1.1.3-8.i386.rpm

Once you have the RPM Package of vsftpd, you can install it.
Rpm-Uvh vsftpd-1.1.3-8.i386.rpm
In this case, Vsftpd is now officially installed.

Step 2: Start and test in standalone mode

Copy codeThe code is as follows:
Vi/etc/vsftpd. conf

Add the following line or check whether the following line exists in the file:

Copy codeThe code is as follows:
Listen = YES

Save and exit.
Start vsftpd now...

Copy codeThe code is as follows:
/Usr/sbin/vsftpd &

Now, run the ftp command to your server. you can see the following session information after successful login:

Copy codeThe code is as follows:
[Root @ somehost] ftp localhost
Connected to localhost. localdomain.
220 (vsFTPd 1.2.1)
Name (localhost: admin): bobsmith (obviously, you must use a valid user on your server)
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
Ftp> ls
150 Here comes the directory listing.
-Rw-r -- 1 1001 1001 25372 Jan 17 somefile.tar.gz
Drwx ------ 2 1001 1001 512 Jan 16 index.htm
226 Directory send OK.
Ftp> quit
221 Goodbye.
[Root @ somehost]

If you are ready, you can see the returned information similar to the above! If you want your FTP server to run on inetd or xinetd, you need to continue the test below. I personally recommend that you run the FTP server on inetd or xinetd.

Step 3: Configure inetd/xinetd

To configure vsftpd in inetd or xinetd, perform the following operations:

First, edit/etc/vsftpd. conf and tell it that vsftpd is not running in the "standalone" mode:

Copy codeThe code is as follows:
Vi/etc/vsftpd. conf

Confirm the existence of the downstream and set it to "NO ":

Copy codeThe code is as follows:
Listen = NO

If you are running inetd, perform the following operations:

Copy codeThe code is as follows:
Vi/etc/inetd. conf

If the file contains any "ftp" lines, comment out or delete them and add the following lines:

Copy codeThe code is as follows:
Ftp stream tcp nowait root/usr/local/sbin/vsftpd

Save and exit.
Restart inetd now:

Copy codeThe code is as follows:
/Etc/rc. d/init. d/inetd restart

 
If your xinetd is running, perform the following operations:
Redhat User:

Copy codeThe code is as follows:
Vi/etc/xinetd. d/vsftpd
# Default: off
# Description: The vsftpd FTP server serves FTP connections. It uses \
# Normal, unencrypted usernames and passwords for authentication.
Service ftp
{
Disable = no
Socket_type = stream
Wait = no
User = root
Server =/usr/sbin/vsftpd
Nice = 10
}

Save and exit.

Stop and restart xinetd...

Copy codeThe code is as follows:
/Etc/rc. d/init. d/xinetd restart

Now let's test the inetd/xinetd ftp server:

Copy codeThe code is as follows:
[Root @ somehost] ftp localhost
Connected to localhost. localdomain.
220 (vsFTPd 1.2.1)
Name (localhost: admin): bobsmith (obviously, you must use a valid user on your server)
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
Ftp> ls
150 Here comes the directory listing.
-Rw-r -- 1 1001 1001 25372 Jan 17 somefile.tar.gz
Drwx ------ 2 1001 1001 512 Jan 16 index.htm
226 Directory send OK.
Ftp> quit
221 Goodbye.
[Root @ somehost]

If you are ready, you can see the returned information similar to the above! Congratulations, your FTP server is running properly! In the next step, we will adjust the vsftpd configuration to provide the best performance.

Step 4: vsftpd master configuration file

The main configuration of vsftpd should be in:/etc/vsftpd. conf. this file determines how to operate your vsftpd FTP server. you must go to vsftpd. conf to check whether the following configuration options are included. Although I cannot talk about all the options, the list lists the important parts of vsftpd configuration:

Anonymous_enable = NO/YES

This switch is used to enable anonymous FTP access. if this option is enabled, configure the anonymous service according to step 3. if you do not know what an anonymous FTP service is, it is best to set this option to "ON"

Local_enable = NO/YES

Enable or disable this option to allow the local system user to FTP to your server. A typical FTP server sets it to "YES ". I think there is only one option to select "NO ",

Write_enable = NO/YES
Enable or disable FTP write. you must set it to "YES ".

Local_umask = 022 (or set it based on your needs)
The default umask value of vsftpd is: 077. it determines the initial permission obtained when the directory and file are created.

Xferlog_enable = YES
This option enables or disables server upload and download logging.

Ftpd_banner = Welcome to blah FTP service
This option is not defined in any form, but it can customize a more friendly greeting for your FTP server.

Chroot_list_enable = NO/YES
Chroot_list_file =/etc/vsftpd. chroot_list
This is a very important feature for enabling the "chroot" option. when "chroot_list_enable" is set to "YES", vsftpd searches for the next row specified by "chroot_list_file. listed in "/etc/vsftpd. any user in the chroot_list file will automatically "chrooted" to their home directory. this will prohibit the user from entering any location except him or her main directory. it is very suitable for shared FTP environments or security and confidentiality.

Userlist_enable = NO/YES
Userlist_deny = NO/YES
The "userlist_enable" option is used to control one of the following two files: vsftpd. ftpusers and vsftpd. user_list. if this option is set to "YES", the two files will list the usernames that are allowed to access the FTP service. in any case, when "userlist_deny = YES" is added, the user names listed in the two files are not allowed to access the FTP service. this option is a very useful function to deny access to key system users through ftp. such as "root", "apche", or "www. it is a good use for the security of your FTP server.

Step 5: vsftpd. ftpusers, vsftpd. user_list configuration file

These two files are directly connected to/etc/vsftpd. the "userlist_enable" option in the conf configuration file is associated with the "userlist_deny" option. when the "userlist_enable" option is set to "YES", users in the two file lists will be allowed to access the FTP server. however, when the "userlist_deny = YES" option is added, users in the two file lists are not allowed to access the FTP server. when the "userlist_deny" option is used, it determines whether a user is denied by the FTP service. it mainly depends on which one of the above two files exists.

If a user exists in "vsftpd. user_list" and "userlist_deny" at the same time, when the user tries to connect to the FTP server, the user will not receive a password prompt when requesting FTP connection and will be rejected.

If a user exists in both "vsftpd. user_list" and "userlist_deny", the user must change the password after logging in.

Personally, I prefer "vsftpd. user_list "to create a user list (root, apache, www, nobody, etc .) if anyone has never seen a password prompt, he should initialize the FTP connection.

Step 6: vsftpd. chroot_list configuration file

"Vsfrtpd. chroot_list ": when the" chroot_list_enable "option is enabled, all user list files created for FTP, no matter who they are, must be" chrooted "to the master FTP directory. those users cannot change the path to other user directories. this is a very good function in a highly confidential public FTP environment.
You can change your configuration file at any time, and then restart vsftpd after confirmation!

This is simple. There are many other options here, depending on your

Related Article

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.