FTP server built under Linux (Ubuntu16.04)

Source: Internet
Author: User
Tags create directory

Made the next FTP server, basically can encounter problems are encountered-. -!

First, step:

1. Installing the VSFTPD Package

sudo Install vsftpd

2. Open the configuration file

Vim/etc/vsftpd.conf

3. Modifying parameters

Some parameters can be removed from the comment activation, for convenience, you can also comment all, and then add the following settings

#这些设置系统默认是开启的, you can ignore listen.=Nolisten_ipv6=yesdirmessage_enable=Yesuse_localtime=yesxferlog_enable=yesconnect_from_port_20=yes# The following will be customized settings, it is recommended that the system default regardless, and then copy the following # whether to allow anonymous access, no is not allowed anonymous_enable=no# whether to allow local user access, which is the presence of Linux native users, yes allows local_enable=yes# whether to turn on write mode, YES to open write_enable=yes# New file permissions, generally set to 022, then the permissions of the newly created file is 777-022=755Local_umask=022#是否启动userlist为通过模式, yes, only users who exist in the UserList file can log in to FTP (as UserList is a whitelist), no, whitelist fails, and the following parameter is used Userlist_ Enable=yes# whether to start userlist as Forbidden mode, YES indicates that the user in UserList is forbidden to log on to FTP (blacklist), no means that the blacklist fails, we have made userlist a whitelist, so there is no need to use the Blacklist function userlist_ Deny=no# Specify which file to use as the UserList file, we will edit this file later Userlist_file=/etc/vsftpd.user_list# whether to restrict all local users to switch root permissions, yes is the limit, that is, the user after login cannot access the directory outside the FTP root directory, of course, to limit the Chroot_local_user=yes# whether to start a Restricted user list for Allow mode, the above YES limits all users, can use this list as a whitelist, as an exception to allow access to the FTP root directory outside of Chroot_list_enable=yes# sets which file is a list file, the user inside will not be restricted to access the directory outside the FTP root directory chroot_list_file=/etc/vsftpd.chroot_list# whether to turn on write mode, can be opened after the creation of folders and other write operations Allow_writeable_chroot=yes# Set the location of the FTP root directory, this file we will create ourselves later Local_root=/var/myftp

Restart VSFTPD

sudo /etc/init.d/vsftpd restart

4. Add an FTP user

By the way, set the user directory to our FTP root directory above

sudo useradd-d/var/myftp ftpuser

Set User password

sudo passwd Ftpuser

5. Create the required files, set folder permissions

Above we have specified two files, userlist files and list files, sometimes the system will not be created automatically, you have to create

Vim/etc/vsftpd.user_list

And then add ftpuser into the whitelist as a member.

Vim/etc/vsftpd.chroot_list

Set to Empty

Create a user folder, set permissions

mkdir /var/myftp

Permission settings can be set according to your usage scene, I here in the root directory prohibit this user write, and then build two folders below, a download only allow read, upload allow write and read

cd/var/myftpchmod555  myftpmkdir  uploadchmod  755  Uploadmkdir  downloadchmod555 download

Finally check the file owner and change to Ftpuser

6. Use FTP to solve various problems

Linux Access input FTP plus your IP

FTP xxx.xxx.xxx.xxx

Enter user name Ftpuser and password

If the login appears with a 530 error:

Vim/etc/pam.d/vsftpd

Comment out #auth required pam_shells.so

Then LS, if it fails, switch to passive mode

Passive mode

and mkdir to find out. Unable to create folder 550 the Create directory operation failed

Setsebool-P ftpd_disable_transon/etc/init.d/vsftpd restart

Can

FTP server built under Linux (Ubuntu16.04)

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.