Linux Quick Build FTP server

Source: Internet
Author: User
Tags ftp commands ftp connection file transfer protocol

FTP is the abbreviation for file Transfer Protocol (document Transfer Protocol), and Chinese is called "Interfax protocol". Used for two-way transmission of control files on the Internet. At the same time, it is also an application (application). There are different FTP applications based on different operating systems, and all of these applications follow the same protocol to transfer files. In the use of FTP, users often encounter two concepts: "Download" (Download) and "Upload" (Upload).

Generally in a variety of Linux distributions, the default with the FTP software is vsftp, from the various Linux distributions to vsftp recognition can be seen, vsftp should be a good FTP software.

1. Check and install VSFTPD software

Use the following command #rpm-qa |grep VSFTPD can detect if the VSFTPD software is installed,

If it is not installed, install it using the Yum command.

2. Start the service

Using VSFTPD software, mainly includes the following commands:

Start ftp command #service vsftpd start

Stop FTP command #service vsftpd stop

Restart FTP command #service vsftpd restart

3, the VSFTPD configuration

There are three main FTP configuration files, which are located in the/etc/vsftpd/directory, respectively:

Ftpusers This file is used to specify that those users cannot access the FTP server.

User_list the default account that the file uses to indicate that the FTP is not accessible by default

4, take the anonymous user as an example, we remove the configuration file vsftpd.conf inside the following

Anon_upload_enable=yes

Anon_mkdir_write_enable=yes

Two previous # numbers, you can complete the configuration of anonymous users, the anonymous user can log in both upload, download files. Remember to restart the service after modifying the configuration file.

Vsftpd.conf VSFTPD's master configuration file

How do I upload and download files using the FTP command at the command line? Step 1: Establish an FTP connection

To connect to an FTP server, enter and then space on the command to ftp follow the FTP server's domain name ' domain.com ' or IP address

For example:
    1. ftp domain.com
    2. ftp 192.168.0.1
    3. ftp [email protected].com

Note: The anonymous server is used in this example.

Replace the following example with an IP or domain name for your server address.

Step 2: Login with username and password

The vast majority of FTP servers are password protected, so these FTP servers ask for 'username' and 'password'.

If you connect to an FTP server known as an anonymous FTP server (LCTT: That is, you do not need to have real user information to use as an anonymous FTP server), you can try to use the username as anonymous well as the blank password:

    1. Name: anonymous
    2. Password:

After that, the terminal will return the following information:

    1. 230Login successful.
    2. Remote system type is UNIX.
    3. Using binary mode to transfer files.
    4. ftp>

Login successful.

Step 3: Directory Operations

FTP commands can list, move, and create folders as if we were using our computer locally. You can ls print a list of directories, cd you can change the directory, mkdir you can create folders.

Listing directories using security settings
    1. ftp>ls

The server will return:

    1. 200 PORT command successful.Considerusing PASV.
    2. 150Here comes the directory listing.
    3. directory list
    4. ....
    5. ....
    6. 226Directory send OK.

Change Directory:

Change the directory to enter:

    1. ftp>cd directory

The server will return:

    1. 250Directory succesfully changed.

Step 4: Download files using FTP

Before downloading a file, we first need to use the lcd command to set the local accept directory location.

    1. lcd /home/user/yourdirectoryname

If you do not specify a download directory, the file will be downloaded to your working directory when you log in to FTP.

Now, we can use command get to download the file, for example:

    1. getfile

The file is saved in the directory location that is set using the LCD command.

Server return message:

  1. local:file remote:file
  2. 200 PORT command successful.Considerusing PASV.
  3. 150Opening BINARY mode data connection forfile(xxx bytes).
  4. 226File send OK.
  5. XXX bytes received in x.xx secs (x.xxx MB/s).

Download files using FTP

You can use wildcard characters and commands to download multiple files mget . For example, I'm going to download all the files ending with. xls in the following example.

    1. mget *.xls
Step 5: Upload files using FTP

FTP can also upload files after FTP connection is completed

To put upload a file using a command:

    1. put file

The absolute path can be used when the file is no longer in the current local directory:

    1. put /path/file

Again, you can upload multiple files:

    1. mput *.xls

Step 6: Close the FTP connection

After completing the FTP work, you need to close the connection for security reasons. There are three commands to close a connection:

    1. bye
    2. exit
    3. quit

Any command can disconnect the FTP server and return:

    1. 221Goodbye

For more help, you can use the FTP command to get more help after you connect to the server help .

Linux Quick Build FTP server

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.