Ubuntu10.04 use vsftp

Source: Internet
Author: User
Recently, I have been playing vsftp in Ubuntu10.04 for a few days. The main goal is to share the two computers. samba is too old to use it now. It is better to use vsftp, which is simple and secure, below is a record of this process, and then use vsftp to get an ftp of the advanced level. The following operations are all performed under root. Due to my limited technical skills, this article is not a tutorial and is for reference only. Vsftp is "very secure ftp ". 1. install apt-getinsta and have been playing vsftp for a few days in Ubuntu 10.04 recently. The main purpose is to share the two computers. samba is too old to use it now. It is better to use vsftp, simple and secure. Let's record the process of tossing this one and use vsftp to get an ftp of the advanced level. The following operations are all performed under root. Due to my limited technical skills, this article is not a tutorial and is for reference only.

 Vsftp is "very secure ftp ".

1. Install

 Apt-get install vsftpd

 Why is there a d? In general, d indicates the system service process. Therefore, vsftpd is used during installation, which is the same in ssh and so on.

2. vsftpd Environment

 1} After vsftp is installed, an ftp account and password ftp will be generated, which can be seen in/etc/passwd. Generally, an ftp file can be created at this time, set/home/ftp by yourself. You 'd better change ftp to 777.

 2}/etc/vsftpd. conf is the configuration file of vsftpd, which is very important.

 3}/etc/pam. d/vsftpd files related to the pam group. The pam group is mainly used for identity authentication and defense. You do not need to know this in the early stage.

 4}/Etc/ftpusers is mainly used together with the above, set the account that refuses to log on, usually the account on the local machine, vim it, will find the root in the column, this also explains why I cannot log on to ftp under the root account at the beginning.

 5} finger ftp. This command is mainly used to view some information about the ftp user, including the logon time and default home directory. Among them, the ftp user's home directory is used as the directory displayed by anonymous login users (that is, the root directory of anonymous users ).

3. Some important concepts and operations

 Ftp localhost

  This means that the local machine is connected to ftp, that is, to connect to ftp on your Ubuntu. localhost actually means to provide a link to the application through the lookback interface, the IP address of localhost is 127.0.0.1. You can think of this IP address as the IP address of your computer. It is only used for internal system program communication.

 Chroot

 Change root diectry: root refers to the root directory. Why does it happen? Once someone else connects to your ftp, it can access the directory from the parent, that is to say, it is not easy to access any of your files. Therefore, you can use chroot to restrict connected users to a directory and access everything in this folder, however, you cannot jump out of this folder to access the parent directory. This chroot is very important.

 Chown

 This is a command for changing the user group to which the file belongs. It will be described later.

4. Functions and configurations of vsftp in your environment. The following describes your configurations and some functions.

 Functions of vsftp:

 Anonymous Users are allowed to log on. The logon directory is/srv/ftp (that is, the ftp user home directory obtained by finger ftp. This is the default vsftp directory). Anonymous Users only have the download permission, you are not authorized to upload or create folders, and are restricted to/srv/ftp Directories. You are not allowed to view parent directories (such as my/ect/boot directories ).

  Allow local users to log on. Local Users are users on your Ubuntu machine, such as root, ftp, and xxx users. Local Users have all permissions, the default directory is/home/ftp (So create a directory above), and you can access any directory on the machine.

 Enable FTP logging to record all FTP operations. In vsftpd. conf, many configurations are linked. For example, if write_enable is not enabled, setting upload = YES is useless. Learn more and you will know something.

 The content of vsftpd. conf is as follows.

# Example config file/etc/vsftpd. conf
#
# The default compiled in settings are fairly paranoid. This sample file
# Loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd. conf.5 for all compiled in defaults.
#
# Read this: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd. conf.5 manual page to get a full idea of vsftpd's
# Capabilities.
#
#
# Run standalone?Vsftpd can run either from an inetd or as a standalone
# Daemon started from an initscript.
Listen = YES# There are comments, and there is no need to record them, that is, to enable vsftpd in standalone mode. This is generally the case.
#
# Run standalone with IPv6?
# Like the listen parameter, parameter t vsftpd will listen on an IPv6 socket
# Instead of an IPv4 one. This parameter and the listen parameter are mutually
# Exclusive.
# Listen_ipv6 = YES
#
# Allow anonymous FTP? (Disabled by default)
Anonymous_enable = YES # whether anonymous users are allowed to log on
#
# Uncomment this to allow local users to log in.
Local_enable = YES # Do You Want to allow a local user to log on? What is a local user? As mentioned above...
#
# Uncomment (look up to dictionary) this to enable any form of FTP write command.
Write_enable = YES # Write Permission. This is required for upload.
#
# Default umask for local users is 077. You may wish to change this to 022,
# If your users CT that (022 is used by most other ftpd's)
Local_umask = 022 # This indicates the permission of the local user to upload files. 022 = 777 077 = 755.
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# Has an effect if the above global write enable is activated. Also, you will
# Obviously need to create a directory writable by the FTP user.
Anon_upload_enable = NO # whether anonymous users are allowed to upload files
#
# Uncomment this if you want the anonymous FTP user to be able to create
# New directories.
Anon_mkdir_write_enable = NO # whether anonymous users are allowed to create folders
No_anon_password = YES # ignore password check when an anonymous user logs on
#
# Activate directory messages-messages given to remote users when they
# Go into a certain directory.
Dirmessage_enable = YES # display Folder Information, that is, when a user enters a file directory, some prompt information you have written in advance will be displayed.
#
# If enabled, vsftpd will display directory listings with the time
# InYourLocalTimeZone.The default is to display GMT.
# Times returned by the mdtm ftp command are also affected by this
# Option.
Use_localtime = YES# This mainly solves the problem of file time.
#
# Activate logging of uploads/downloads.
Xferlog_enable = YES # Enable Logging
#
# Make sure PORT transfer connections originate from port 20 (ftp-data ).
Connect_from_port_20 = YES # specify the FTP data port
#
# If you want, you can arrange for uploaded anonymous files to be owned
# A different user. Note! Using "root" for uploaded files is not
# Recommended!
# Chown_uploads = YES# This indicates that if anonymous users can upload files, a dedicated upload directory for anonymous users will be set up for a long time.
# Chown_username = whoever # the owner of all files uploaded by anonymous users will change to "whoever"
#
# You may override where the log file goes if you like. The default is shown
# Below.
# Xferlog_file =/var/log/vsftpd. log # Set the location of the log file. The default setting is good.
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is/var/log/xferlog in this case.
# Xferlog_std_format = YES # whether to use the standard log file format, which is mainly used for viewing some software. Ignore this
#
# You may change the default value for timing out an idle session.
Idle_session_timeout = 600 # Set the idle connection time. If a connection is not operated, it will be disconnected after 600 seconds.
#
# You may change the default value for timing out a data connection.
Data_connection_timeout = 120 # data connection timeout setting, no data transmission within 120 seconds, disconnected
#
# It is recommended that you define on your system a unique user which
# Ftp server can use as a totally isolated and unprivileged user.
# Nopriv_user = ft1_cure
#
# Enable this and the server will recognize asynchronous ABOR requests. Not
# Recommended for security (the code is non-trivial). Not enabling it,
# However, may confuse older FTP clients.
# Async_abor_enable = YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# The request. Turn on the below options to have the server actually do ASCII
# Mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# Attack (DoS) via the command "SIZE/big/file" in ASCII mode. vsftpd
# Predicted this attack and has always been safe, reporting the size of
# Raw file.
# ASCII mangling is a horrible feature of the protocol.
# Ascii_upload_enable = YES# Set whether the uploaded and downloaded files are in ascii format
# Ascii_download_enable = YES
#
# You may fully customise the login banner string:
Ftpd_banner = this is wc's ftp, which has been testing # Welcome Information
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# Useful for combatting certain DoS attacks.
# Deny_email_enable = YES
# (Default follows)
# Banned_email_file =/etc/vsftpd. banned_emails
#
# You may restrict local users to their home directories.See the FAQ
# The possible risks in this before using chroot_local_user or
# Chroot_list_enable below.
# Chroot_local_user = YES # Restrict Local User Directories, which I do not use.
#
# You may specify an explicit list of local users to chroot () to their home
# Directory. If chroot_local_user is YES, then this list becomes a list
# Users to NOT chroot ().
Chroot_list_enable = YES# If chroot_local_user is YES, you can enable this function. users in the list file below will not be restricted by chroot.
# (Default follows)
Chroot_list_file =/etc/vsftpd. chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled
# Default to 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 for enabling it.
# Ls_recurse_enable = YES
#
# Debian customization
#
# Some of vsftpd's settings don't fit the Debian filesystem layout
# Default.These settings are more Debian-friendly.
#
# This option shoshould be the name of a directory which is empty.Also,
# Directory shocould not be writable by the ftp user. This directory is 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 will use.
Pam_service_name = vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# Encrypted connections.
Rsa_cert_file =/etc/ssl/private/vsftpd. pem
Local_root =/home/ftp # directory entered by the local user upon Logon
Max_clients = 100 # maximum number of allowed clients

 In fact, the configuration of vsftp is still complicated and has many functions, which are not described in detail above.

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.