How to install vsftpd server under Linux

  
                

The biggest feature of the vsftpd server is that it is safe enough to run on a Linux system. It is an ftp server software. The following small series will introduce you how to install the vsftpd server under Linux.

The ftp server program we use is vsftpd, which is considered to be the most popular open source FTP server under Linux.

Installing the vsftpd Server Program

The traditional Linux installation method is to download the tar.gz installation package, or the RPM installation package, compile after decompression, or install it with the RPM -i command. The process is cumbersome, we use the yum command to install online, so you can automatically select the latest version of the program, very convenient.

yum install vsftpd press the input y to confirm the installation. When “Complete! & rdquo; when the installation is complete.

Then enter chkconfig vsftpd on service vsftpd start to set vsftpd to boot and start the vsftpd service.

Modify the vsftpd configuration file

The default location of the vsftpd configuration file is: /etc/vsftpd/vsftpd.conf. Normally, you need to back up an original configuration file and then edit it. The specific steps are as follows:

Enter mv vsftpd.conf vsftpd.conf-old Change the vsftpd.conf file to vsftpd.conf-old Backup, type vi /etc/vsftpd/vsftpd.conf Create and edit vsftpd.conf file.

Then open the new vsftpd.conf file and write it as follows:

anonymous_enable=NO//Do not allow anonymous users to log in. Usually ftp on our web server does not allow anonymous login. Br>

local_enable=NO//Forbidden (or allow) local user login

write_enable=YES//Gate writable permissions

chroot_local_user=YES//lock user directory, ftp User login ftp can only be operated in its own directory

anon_upload_enable=NO

anon_mkdir_write_enable=NO//Disable anonymous user upload, new directory permission

dirmessage_enable=YES//Allow ftp users to list file directories

xferlog_enable=YES//write logs

connect_from_port_20=YES

listen=YES//use port 20, usually these Is the default

pam_service_name=vsftpdpamconf

userlist_enable=YES

tcp_wrappers=YES//It is important to specify the configuration file for pam authentication

guest_enable= YES//Open virtual user

Guest_username=apache//specifies the permission of the virtual user to use the local user apache. This is especially important. The ftp virtual user on the web server must be set to apache permission. Otherwise, the file uploaded by ftp cannot be accessed normally, and the website generated cannot be modified. file.

user_config_dir=/etc/vsftpd/vuser_conf//Virtual user configuration file storage location

virtual_use_local_privs=YES//Virtual users use local user rights, this must be, otherwise ftp users can not Change the file permissions

Then save and exit the vi editor, execute: service vsftpd restart, restart the vsftpd service test configuration file is correct.

Adding a vsftpd virtual account:

We need to create a virtual user db library in the /etc/vsftpd directory:

Enter vi vuservsftpd.txt Create and edit the file vuservsftpd.txt Write the virtual user and password you want to create. The single action username doubles the password. Note that there can be no spaces, such as:

vuser1

password1

vuser2< Br>

password2

Save and exit after the build is complete, then use the db command to generate the virtual user library file needed for vsftpd authentication:

db -T -t hash -f vuservsftpd. Txt vsftpdpamconf.db//Note that the db file name should be the same as the pam authentication name set in vsftpd.conf

For security, you can delete the newly created vuservsftpd.txt, and then create a new user name next time. You can also set the vsftpdpamconf.db file permission to 644.

Add vsftpd virtual account configuration file:

The virtual account does not have a corresponding configuration file will not take effect. In step 1 we have determined the configuration file directory of the virtual account in the vsftpd.conf file: /etc/vsftpd/vuser_conf, below we enter this directory to work:

The configuration file must be named the same as the virtual account name, so we created two new files: vuser1, vuser2, and write as follows Configuration information:

local_root=/var/www/html/demo//Set a more directory for virtual users, because we need to implement a ftp account management for each website, so his root directory is what we need to manage Website virtual directory.

write_enable=YES

download_enable=YES

anon_upload_enable=YES

anon_mkdir_write_enable=YES

anon_other_write_enable=YES//Give virtual users Write, download upload, create new directory and other permissions

anon_world_readable_only=no//I don't understand the meaning of this, but it must exist

You can add or unregister some permissions as needed, logout only You need to add the “#” in front of the statement, or you can delete it directly.

Now the FTP of the Linux server is configured successfully. At this point, you can test whether it can be used normally.

The above is the introduction of the method of installing vsftpd server under Linux. According to the above steps, you can easily install the vsftpd server. Is it very simple? Give it a try.

Copyright © Windows knowledge All Rights Reserved