Configure the ftp server on Linux

Source: Internet
Author: User
Tags ftp login socket error
Configure the ftp server-Linux Enterprise Application-Linux server application information on Linux. The following is a detailed description. Because I want to upload things to linux, I got vsftp and found a lot of tutorials on the Internet, but I feel that I haven't written them in many places. Based on my own configuration experience. I don't need to use advanced applications. I will not write them for the moment. I will try again when I have time to do so.

The environment is the redhat linux as 3 in vm5. I installed vsftp.

The configuration file is/etc/vsftpd. conf. Edit this file as follows. If you edit the file, use vi.

Note that in the following configuration, the first letter of Anonymous_enable = yes is in lower case and must be corrected.
1) allows anonymous users to upload and download files.

Program code:
Anonymous_enable = yes anonymous login
Connect_form_port_20 = yes enable data connection on the FTP data port
Pam_service_name = vsftpd Verification Method
Listen = yes independent VSFTPD Server


In this way, you can log on to ftp anonymously, but you cannot upload files.

Program code:
Anon_upload_enable = yes. The upload permission is enabled.
Anon_mkdir_write_enable = yes: You can create a directory and upload files to it.
Write_enable = yes: grant write permission to the local user.
Anon_other_write_enable = yes anonymous account can be deleted

In addition, you can upload and download files anonymously through ftp.

Then you save the file and use service vsftpd start to start the vsftp service. Then you can use ftp.

Note: Make sure that port 21 is enabled on your firewall iptables. Otherwise, the system will prompt a socket error and reject the connection when you log on to ftp. Also, when you edit vsftp again. after the conf file is restarted with service vsftpd restart, it always prompts you Not to disable the vsftp service. At this time, you can use service vsftpd status to check its status, if you are prompted that vsftpd is locked, it may be because of your vsftpd. there is an error in the configuration in conf. You need to edit it again until it can be restarted normally. One configuration is incorrect. Just configure it several times.

2) Implement Local User upload and download
Program code:
Create a user
Adduser username adds a user
Passwd user name to Add User Password
Then, read the last line in/etc/passwd, which is the user information you just added.
Edit the/etc/vsftpd. conf file,
Local_enable = yes allow local users to log on to ftp
In/etc/vsftpd. ftpuser, you can add users who want to prevent ftp login.
Restrict users to be in their own directories only
The list in the Chroot_list_enable = yes file can be called.
Chroot_list_file =/etc/vsftpd. chroot_list the premise is chroot_local_user = no, add the user name to the file



Vsftpd. conf Parameters
Program code:

Anonymous_enable = yes allow anonymous login
When Dirmessage_enable = yes is used to switch the directory, the contents of. message under the directory are displayed.
Local_umask = 022 local file permission on FTP. The default value is 077.
Connect_form_port_20 = yes enable data connection on the FTP data port
Xferlog_enable = yes. Activate the uploaded and downloaded logs.
Xferlog_std_format = yes use the standard log format
Ftpd_banner = XXXXX show welcome information
Pam_service_name = vsftpd Verification Method
Listen = yes independent VSFTPD Server
Anon_upload_enable = yes anonymous user upload permission
Anon_mkdir_write_enable = yes. When creating a directory, you can upload files to the directory.
Write_enable = yes permission written by the local user
Anon_other_write_enable = yes anonymous account can be deleted
Anon_world_readable_only = no anonymous user browsing permission
Ascii_upload_enable = yes enables the upload ASCII Transmission Mode
Ascii_download_enable = yes enable the ASCII transmission mode for download
Banner_file =/var/vsftpd_banner_file after the user connects, welcome information in this file
Idle_session_timeout = 600 (seconds) 10 minutes after the user's session is idle
Data_connection_timeout = 120 (seconds) disconnect the data connection for 2 minutes
Accept_timeout = 60 (seconds) disconnect the client after being idle for 1 minute
Connect_timeout = 60 (seconds) interrupted for 1 minute and then reconnected
Local_max_rate = 50000 (bite) Local User transfer rate 50 K
Anon_max_rate = 30000 (bite) Anonymous user transfer rate 30 K
Pasv_min_port = 5000 change the client's data connection port
Pasv_max_port = 6000 between and
Max_clients = 200 maximum number of FTP connections
Max_per_ip = 4 maximum number of connections per IP
Listen_port = 5555 data connection from port 5555
Local_enble = yes local account can log on
Write_enable = no. You are not authorized to delete or modify files after logging on to the local account.
Chroot_local_user = yes all local accounts can only be in their own directories
The list in the Chroot_list_enable = yes file can be called.
Chroot_list_file =/etc/vsftpd. chroot_list prerequisite: chroot_local_user = no
Userlist_enable = yes is not accessible to users in the specified file
Userlist_deny = yes
Userlist_file =/etc/vsftpd. user_list
Banner_fail =/path/file name display the file content when connection fails
Ls_recurse_enable = no
Async_abor_enable = yes
One_process_model = yes
Listen_address = 10.2.2.2 bind the virtual service to a port
Guest_enable = yes virtual user can log on
Guest_username = specifies the user name used to map a virtual user to a local user.
Chown_uploads = yes. Change the object owner to root.
Chown_username = root
Deny_email_enable = yes whether anonymous users are allowed to use certain email addresses
Banned_email_file = // any specified path/xx/
Pasv_enable = yes the server uses the passive mode.
User_config_dir =/any specified path // any file directory specifies the path where the virtual user stores the configuration file
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.