Ubuntu build FTP server, can be accessed through the browser, FileZilla upload files and other functions

Source: Internet
Author: User
Tags local time filezilla

Setting up an FTP server

1: first, Update the software source, to ensure that the source is up-to-date, so that the following online through apt-the get install command installs FTP. 2: use sudo apt-The Get install vsftp command installs the vsftp, the installation software requires root privileges, we use sudo to temporarily obtain. 3: The FTP user is automatically created by default after installing ftp, then we set the FTP User's password, enter 4:sudo passwd ftp, then enter the password, then confirm the Password. the directory created for FTP users defaults to /srv/ FTP
5: to/etc/vsftpd.conf configuration files for certain modifications. Using sudo gedit/etc/vsftpd.conf Open the configuration File. In the configuration file, "anonymous_enable=YES (if Anonymous FTP is allowed, if no is allowed) remove the comment symbol before the following configuration: local_enable=YES (allow Local users to log In) near line 27: #本地用户, liyafei, password write_enable=YES (allow Local Users to write Permissions) near line 29: Chroot_local_user=YES (whether to restrict all users to the home Directory) near line 121: chroot_list_enable=YES (whether to start the restricted users List) chroot_list_file=/etc/vsftpd.chroot_list (multiple accounts can be set in the File)/***********************/etc/vsftpd.conf ***************************/# The user does not has the write access to the top level directory within the# Chroot) chroot_local_user=yeschroot_list_enable=yes# (defaultFollows) Chroot_list_file=/etc/Vsftpd.chroot_list#chroot_list_file=/etc/Chroot_list Then restart the FTP service, use the command sudo service vsftpd Restart restart the FTP service

The browser successfully succeeded by ftp://192.168.100.91 access to the directory successfullyhttps://jingyan.baidu.com/article/a948d6512ef9d00a2dcd2ea3.html

Uploading Files via FileZilla

Many user directories can be created in the home directory. Configure the/etc/vsftpd.conf as follows

userlist_deny=nouserlist_file=/etc/allowed_usersseccomp_sandbox=nolocal_root=/home/ftp

Then users in The/etc/allowed_users can log on to the server through the user name and password to ACCESS/HOME/FTP

/etc/allowed_users File Contents

User1  
User2

Then User1,user2 users and Local users can access the content In/home/ftp.

Upload the file with the FileZilla client, because the folder in/home/ftp does not have write permission, so when uploading: 553 Could not create file

We need to create a folder with Write permissions under The/home/ftp folder, such as Create folder write;

/home/ftp/-r 777/home/ftp/Write then modifies the vsftp configuration file /etc/vsftpd.conf file on the last addlocal_root =/ home/ftp   #这是allowed_users folder in which the user accesses the path to the above profile, has been added to save, then kills the vsftpd process, and then restarts the VSFTPD server Program. try, upload the file to the write directory, this time can be normally uploaded files. 

You can then upload the file to The/home/ftp/write Folder.

similarly, We can create a folder with Write permissions in The/srv/ftp folder for users named FTP to add Files.

Summary: User name FTP user Access To/srv/ftp folder

Local Users and users in Allowed_users access to the specified Local_root folder

If you need to upload a feature, you need to create a write-capable folder under the folder

Configuration file:

# Example Config file/etc/vsftpd.conf## thedefaultcompiled in Settings is fairly paranoid. This is a sample file# loosens things up a bit, to make the ftp daemon more usable.# please see Vsftpd.conf.5 forall compiled in defaults.## read This:this example file was not a exhaustive list of vsftpd options.# please READ th E vsftpd.conf.5 manual page to get a full idea of vsftpd ' s# capabilities.### Run standalone?VSFTPD can run either from the inetd or as a standalone# daemon started from an Initscript.listen=yes## Run Standalone with IPv6?# like the listen parameter, except VSFTPD would listen on a IPv6 socket# instead of an IPv4 one. This parameter and the Listen parameter is mutually# Exclusive. #listen_ipv6=yes## Allow anonymous FTP? (Disabled bydefault) anonymous_enable=yes## Uncomment thisTo allow Local users to log in.local_enable=yes## Uncomment thisto enable any form of FTP write Command. #write_enable=yeswrite_enable=yes## Default umask forLocal Users is 077. wish to change thisto 022,# ifYour users expect that (022 was used by the most other ftpd ' S) #local_umask =022# # Uncomment thisthe anonymous FTP user to upload Files. This only# have an effectifthe above global write enable is Activated. Also, you will# obviously need to create a directory writable by the FTP user.anon_upload_enable=yes## Uncomment this ifyou want the anonymous FTP user to being able to create#Newdirectories.anon_mkdir_write_enable=yes#anon_other_write_enable=yes# Activate Directory Messages-messages given to remote users while they# go into a certain directory.dirmessage_enable=yes## If enabled, vsftpd would display directory listings with the time# in your local time Zone. thedefaultis to display GMT. the# times returned by the MDTM FTP command is also affected by this# Option.use_localtime=yes## Activate logging of uploads/downloads.xferlog_enable=yes## Make sure port transfer connections originate from Port(ftp-data). connect_from_port_20=yes## If You want, can arrange foruploaded anonymous files to be owned by# a different user. Note! Using "root" foruploaded files is not# recommended!# #chown_uploads=Yes#chown_username=whoever## You may override where the log file goesifLike. Thedefaultis shown# below. #xferlog_file=/var/log/vsftpd.log## If You want, can has your log file in standard ftpd Xferlog format.# Note that thedefaultLog file location Is/var/log/xferlog in this  case. #xferlog_std_format=yes## thedefaultValue fortiming out an idle Session. #idle_session_timeout=600# # you could change thedefaultValue fortiming out a data connection. #data_connection_timeout=120# # It is recommended so define on your system a unique user which the# FTP server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure## Enable thisand the server would recognise asynchronous ABOR Requests. not# Recommended forSecurity (the Code is non-trivial). Not enabling it,# however, may confuse older FTP Clients. #async_abor_enable=yes## bydefaultThe server would pretend to allow ASCII mode and in fact ignore# the Request. Turn on the below options to the server actually doascii# mangling on files while in ASCII mode.# beware this on some FTP servers, ASCII support allows a denial of servi ce# attack (DoS) via the command"size/big/file"in ASCII Mode. vsftpd# predicted thisattack and have always been safe, reporting the size of the# raw file.# ASCII mangling is a horrible feature of the PR Otocol. #ascii_upload_enable=yes#ascii_download_enable=yes## fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service.## your may specify a file of disallowed anonymous E-Mail Addresses. apparently# Useful forcombatting certain DoS attacks. #deny_email_enable=yes# (defaultFollows) #banned_email_file=/etc/vsftpd.banned_emails## restrict local users to their home directories. see the FAQ for# The possible risks in thisbefore using Chroot_local_user or# chroot_list_enable below. #chroot_local_user=yes## Specify an explicit list of the local users to Chroot () to their home# directory. If Chroot_local_user is YES and then thislist becomes a list of# users to not chroot (). # (Warning! Chroot ' ing can be very dangerous. If using chroot, make sure that# The user does not has the write access to the top level directory within the# Chroot) chroot_local_user=yeschroot_list_enable=no# (defaultFollows) Chroot_list_file=/etc/vsftpd.chroot_list## Activate the"-r"option to the Builtin Ls. This is disabled by#defaultTo avoid remote users being able to cause excessive i/O on large# sites. however, Some broken FTP clients such as"ncftp" and "mirror"assume# the Presence of the"-r" option, So there is a strong case  forenabling it. #ls_recurse_enable=yes## customization## Some of vsftpd' s settings don 'T fit the filesystem layout by#default. # # This option should being the name of a directory which is Empty. Also, the# directory should not being writable by the FTP user. This directory was used# as a secure chroot () jail at times VSFTPD does not require filesystem# access.secure_chroot_dir=/var/run/vsftpd/empty## This string is the name of the PAM service vsftpd would use.pam_service_name=vsftpd## This option specifies the location of the RSA certificate forssl# Encrypted Connections.rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem# This option specifies the location of the RSA key to use forssl# Encrypted Connections.rsa_private_key_file=/etc/ssl/Private/ssl-cert-Snakeoil.keyuserlist_deny=Nouserlist_file=/etc/Allowed_usersseccomp_sandbox=no#pasv_enable=Yes#pasv_min_port=3000#pasv_max_port=4000Local_root=/home/ftp

Ubuntu Build FTP server, can be accessed through the browser, FileZilla upload files and other functions

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.