Set up ftp in linux

Source: Internet
Author: User
Tags ftp commands
Recently, in order to facilitate the communication between the target board and LINUX on the PC, FTP was set up in LINUX, which is not difficult to work. The main steps are as follows: 1 check whether the vsftpd server is installed can be viewed with the rpm-qvsftpd command, if the display & ldquo; vsftpd-1

Recently, in order to facilitate the communication between the target board and LINUX on the PC, FTP was set up in LINUX, which is not difficult to work. Perform the following steps:

1. check whether the vsftpd server is installed

You can use the rpm-q vsftpd command to view, if "vsftpd-1.1.3-8" is displayed, it indicates that the vsftpd server has been installed, if not, you can click the "main menu> System Settings> add or delete application" menu item in the graphic environment. in the "software package management" dialog box that appears, make sure that the "FTP server" option is selected, click the "update" button and insert 3rd installation discs as prompted to start installation.

2. start/restart/Stop the vsftpd service

From Red Hat Linux 9.0, vsftpd starts the vsftpd service in standalone mode by default by running the following command in the terminal command window:

[Root @ ahpeng root]/etc/rc. d/init. d/vsftpd start

Restart the vsftpd service:

[Root @ ahpeng root]/etc/rc. d/init. d/vsftpd restart

Disable the vsftpd service:

[Root @ ahpeng root]/etc/rc. d/init. d/vsftpd stop

3. vsftpd configuration

In Red Hat Linux 9.0, vsftpd has three configuration files:

Vsftpd. ftpusers: located in the/etc directory. It specifies which user accounts cannot access the FTP server, such as root.

Vsftpd. user_list: located in the/etc directory. The user account in this file cannot be accessed by default.

The FTP server is allowed only when the userlist_enable = NO option is enabled in the vsftpd. conf configuration file.

Vsftpd. conf: located in the/etc/vsftpd directory. It is a text file. we can use text editing tools such as Kate and Vi to modify it, to customize FTP server configurations, such as user logon control, user permission control, timeout settings, server function options, server performance options, and server response messages.

(1) user logon control

Anonymous_enable = YES, allows anonymous users to log on.

No_anon_password = YES. you do not need to enter a password when logging on as an anonymous user.

Local_enable = YES, allow local users to log on.

Deny_email_enable = YES, you can create a file to save the blacklist of some anonymous emails to prevent these people from using Dos attacks.

Banned_email_file =/etc/vsftpd. banned_emails. when the deny_email_enable function is enabled, the required path for saving the email blacklist is/etc/vsftpd. banned_emails by default ).

(2) User permission control

Write_enable = YES. enable the global Upload permission.

Local_umask = 022. the umask of the local user's uploaded file is set to 022 (the default value is 077. generally, it can be changed to 022 ).

Anon_upload_enable = YES, allows anonymous users to have the upload permission. Obviously, you must enable write_enable = YES.

This option can be used. At the same time, we must create a directory that allows ftp users to read and write data (as mentioned earlier, ftp is mapped to user accounts by anonymous users ).

Anon_mkdir_write_enable = YES. anonymous users are allowed to create directories.

Chown_uploads = YES. if this option is enabled, the owner of the file to be uploaded anonymously will be changed to another user account. Note that you are advised not to specify the root account as the owner of the file to be uploaded anonymously!

Chown_username = whoever. when chown_uploads = YES is enabled, the specified owner account must be replaced by an appropriate user account.

Chroot_list_enable = YES. you can use a list to specify which local users can only be active in their own directories. if chroot_local_user = YES, the specified users in this list are unrestricted.

Chroot_list_file =/etc/vsftpd. chroot_list. if chroot_local_user = YES, specify the save path for the list (chroot_local_user) (/etc/vsftpd. chroot_list by default ).

Nopriv_user = ft1_cure: specifies a secure user account to allow the FTP server to be used as an independent user with full isolation and no privileges. This is a recommended option for vsftpd systems.

Async_abor_enable = YES. we strongly recommend that you do not enable this option, otherwise it may cause errors!

Ascii_upload_enable = YES; ascii_download_enable = YES. by default, the server will pretend to accept requests in asc ii mode but ignore such requests, enabling these two options enables the server to implement transmission in asc ii mode.

(Note: Enabling the ascii_download_enable option will enable malicious remote users to use commands such as "SIZE/big/file" in asc ii mode to consume a large amount of I/O resources on the FTP server .)

The configuration options in asc ii mode are divided into upload and download, so that we can allow upload in asc ii mode (this can prevent the upload of malicious files such as scripts from crashing ), this vulnerability does not cause DoS attacks.

(3) User connection and timeout options

Idle_session_timeout = 600. you can set the default idle time-out period. if you do not wait for this period, the server will be kicked out.

Data_connection_timeout = 120, set the default data connection timeout time.

(4) server logs and welcome information

Dirmessage_enable = YES, allows the display of information for directory configuration, displays the content of the message_file file under each directory

Ftpd_banner = Welcome to blah FTP service. you can customize the Welcome information that FTP users can see when they log on to the server.

Xferlog_enable = YES, enabling the function of recording upload/download activity logs.

Xferlog_file =/var/log/vsftpd. log. you can customize the log file storage path and file name. The default value is/var/log/vsftpd. log.

With the meanings of the above options, you can configure them according to your needs. some options do not need to be changed. after the configuration is complete, confirm that the vsftpd service has been started, you can enter "ftp Addres" in the S command window of the Windows host (replace Addres with the actual FTP server IP address or domain name ), note that the username and password are all ftp (ftp is the ing of anonymous users to user accounts ).

If you cannot log on, you can try to log on locally in LINUX, or log on to FTP in WINDOWS in LINUX. if you can, it is very likely that the reason for not logging on to the FTP in LINUX is the firewall in LINUX. you can use the rpm-q vsftpd command to view the cause. if the firewall is enabled, you can use the command to close it, you can also select "seurity level" in "system settings" in the "main menu" on the GUI. if the system is not changed during installation, the default seurity level is "Medium ", you can select "FTP" in "allow incomning" below without modifying this setting. of course, you can also set the seurity level to "NO firewall ", in this way, you can log on to linux ftp in Windows.

After you log on to the ftp server, refer to the ftp commands. the logon path is/var/ftp/pub, and the files you need can be stored in this directory, I use ftp here to download the compiled files from linux to the board. Generally, you do not need to use ftp to upload files to LINUX, note that some operations on files under ftp may be dropped by fail. pay attention to setting file operation permissions as needed.

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.