This article is tested in the Ubuntu Server 14.04 AMD64 System.
Install FTP
sudo apt-get install vsftpd
Configure vsftpd.conf
sudo nano/etc/vsftpd.conf
#禁止匿名访问
anonymous_enable=no
#接受本地用户
local_enable=yes
#允许上传
write_enable=yes
# The user can only access the restricted directory
Chroot_local_user=yes
#设置固定目录, added at the end. If you do not add this line, each user corresponds to their own directory, of course, this folder itself built
local_root=/home/ftp
Look at the Internet to add a line of "pam_service_name=vsftpd", I think I have this configuration file, it is no matter.
Add an FTP user
sudo useradd-d/home/ftp-m ftpuser
sudo passwd ftpuser
Adjust folder permissions
This is to avoid "OOPS:vsftpd:refusing to run with writable root inside Chroot ()"
sudo chmod a-w/home/ftp
sudo mkdir/home/ftp/data
After this login will see the Data folder, although a little trouble, the reason is not table. It is not easy to find the information so bitter.
Change PAM.D/VSFTPD
At this time directly with Useradd account login FTP will 530 login incorrect
sudo nano/etc/pam.d/vsftpd
Comment out
#auth Required Pam_shells.so
Restart VSFTPD
sudo service vsftpd restart
Then you can use the Ftpuser just built this user login FTP, see the Local_root set/home/ftp, and limited to the directory.
You can use ftp://xxx.xxx.xxx.xxx access in the browser, you can also use FTP software such as FLASHFXP, the password is ftpuser password.
About User Access folder restrictions
By the Chroot_local_user, chroot_list_enable, chroot_list_file These three documents control, transfer other people's passage:
First of all, chroot_list_enable good understanding, is: whether to enable Chroot_list_file configuration files, if yes indicates chroot_list_file configuration of the file is effective, otherwise not effective;
Second, Chroot_list_file is also simple, configured a file path, default is/etc/vsftpd.chroot_list, the file will fill in some account names. But the meaning of these accounts is not fixed, it is related to the configuration item Chroot_local_user. Described in the latter article;
Third, Chroot_local_user for yes means that all users * cannot switch to a directory other than the home directory, but! In addition to the Chroot_list_file configured files listed by the user. Chroot_local_user for no means that all users can * switch to a directory other than the home directory, but! In addition to the Chroot_list_file configured files listed by the user. It can also be understood that chroot_list_file lists the "exceptions" of the user.
If client logon prompts "failed to connect in PASV mode"
Edit/etc/vsftpd.conf
Add last
Then restart the VSFTPD service.
The above is a small set to introduce the Ubuntu with VSFTPD configuration FTP Server tutorial detailed, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!