After implementing the virtual host setting for Multiple Apache users, these users generally choose to use ftp to upload their web content, which requires us to set up FTP services for them.
The FTP server that comes with Ubuntu is vsftpd. Two articles in this article are also recommended. I will provide one article through practice.
1) install vsftpd
It is not difficult to install software in Ubuntu. Enter:
sudo apt-get install vsftpd
You may be prompted to use the CD and press Enter.
After installation, an ftp directory is created under/home. At this time, you can try to access the ftp: // ip address. You can see an ftp space with blank content.
By default, anonymous users can download files, but cannot write or upload files.
2) set the vsftpd. conf file
Now, we need to make anonymous users inaccessible and enter the user password on linux before they can access the contents in their own directories.
First, find the file for setting vsftpd, which is located in/etc/vsftpd. conf.
Back up this file before modification:
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.old
Then you can change the settings:
# Do not allow anonymous users to use it # anonymous_enable = YES # local_enable = YES # write_enable = YES # No need to display file information in a directory # dirmessage_enable = YES # Add a banner prompt ftpd_banner = Hello ~~ # The FTP server can carry max_clients = 100 # Restrict the process max_per_ip = 5 # maximum transfer rate (B/s) local_max_rate = 256000 # Hide account hide_ids = YES
Okay. Restart the ftp server to check the effect.
Is it the same after restart as before? Haha, This is the default ftp directory. Let's delete it and check again. How is it? Enter the user name and password.
New Problems
1. After Entering the username and password, the user's root directory is displayed, and our WEB content is in the public_html directory.
2. You can jump to any other directory (very dangerous ..)
To solve these problems, we have to set vsftpd. conf.
# Start the chroot list (Change root) chroot_list_enable = YES # specify the list location (which is the default address) chroot_list_file =/etc/vsftpd. chroot_list
Next, we need to write it in vsftpd. chroot_list. We want to restrict users so that they will not "drift "..
Currently, linyupark is a user, so you only need to write sudo nano to it.
In this way, we have solved 2nd problems. login users can only activity in their user folders. Below we want to be more aggressive, so that they can only activity in public_html.
Still find vsftpd. conf
# This is not in the default setting. Add user_config_dir =/etc/to define a folder address for setting individual users.
Create a folder Based on the address you set, and then create a file with the same username as the folder. nano:
# The root address of the local user. Assume that the user is linyupark local_root =/home/linyupark/public_html.
Okay. Restart the server. Check the effect. ^_^