Install and Configure ftp in centos 5.5

Source: Internet
Author: User
Tags gpg socket error

1. FTP Installation

1. Check whether FTP is installed: [root @ localhost ~] # Rpm-Q vsftpd

 

If installed, the following version information is displayed:

[Root @ localhost ~] # Vsftpd-2.0.5-16.el5_5.1

Otherwise: [root @ localhost ~] # Package vsftpd Is Not Installed

2. If FTP is not installed, run the yum install vsftpd command.

The specific details are as follows: (if the update fails, you must first configure access to the Internet. I have a document named centos under VMware. How to connect to the Internet can solve the problem of no access to the Internet)

[Root @ localhost ~] # Yum install vsftpd

Setting up install process

Parsing package install arguments

Resolving Dependencies

--> Running transaction check

---> Package vsftpd. i386. 0.5-12. EL5 set to be updated

Filelists.xml.gz 100% | =====================| 648 KB

Http://ftp.hostrino.com/pub/centos/5.2/ OS /i386/rep odata/filelists.xml.gz: [errno 4] socket error: timed out

Trying other mirror.

Filelists.xml.gz 100% | =====================| 2.8 mb

Filelists.xml.gz 100% | =======================| 1.1 MB

Filelists.xml.gz 100% | =====================| 132 KB

Filelists.xml.gz 100% | =======================| 150 B

--> Finished dependency resolution

Dependencies resolved

========================================================== ============================================

Package arch version repository size

========================================================== ============================================

Installing:

Vsftpd i386 2.0.5-12. EL5 base 137 K

Transaction Summary

========================================================== ============================================

Install 1 package (s)

Update 0 package (s)

Remove 0 package (s)

Total download size: 137 K

Is this OK [Y/n]: Y

Downloading packages:

(1/1): vsftpd-2.0.5-12.el 100% |=========================| 137 KB

Warning: rpmts_hdrfromfdno: Header V3 DSA Signature: nokey, key ID e8562897

Importing GPG key 0xe8562897 "CentOS-5 key (centos 5 official signing key) <centos-5-key@centos.org>" from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

Is this OK [Y/n]: Y

Running rpm_check_debug

Running transaction Test

Finished transaction Test

Transaction test succeeded

Running transaction

Installing: vsftpd ######################## [1/1]

Installed: vsftpd. i386. 0.5-12. EL5

Complete!

[Root @ localhost ~] #

3. After FTP installation, comment out the root line in the/etc/vsftpd/user_list file and/etc/vsftpd/ftpusers file.

# Root

4. Run the following command:

# Setsebool-P ftpd_disable_trans = 1

Modify/etc/vsftpd. conf and add local_root =/in the last line/

5. Restart the FTP process # service vsftpd restart

 

Note: every time you modify the ftp-related configuration file, you must restart the FTP process to take effect.

The FTP server can be used.

**************************************** *****************************

Ii. vsftpd configuration file description:

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 access the FTP server by default. Access 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. 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, which allows anonymous users to have the upload permission. Obviously, you must enable write_enable = yes to use this option. 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 FTP server I/O resources.

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, which allows you to display information for directory configuration and 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.

Anonymous_enable = Yes allow anonymous login local_enable = Yes Allow Local User Login

Write_enable = yes: Write Permission for Local Users

Local_umask = 022 set the local user-generated file mask to 022

# Anon_upload_enable = yes this setting allows anonymous users to upload files

# Anon_mkdir_write_enable = Yes Enable write and Directory Creation permissions for anonymous users

Dirmessage_enable = yes when you switch to a directory, the contents of the. Message file under the directory are displayed.

Xferlog_enable = Yes activate upload and download logs

Connect_from_port_20 = Yes Connection Request for enabling the FTP data port

# Chown_uploads = Yes indicates whether the upload permission is granted. The user is specified by the chown_username parameter.

# Chown_username = Whoever specifies the user with the upload permission. This parameter is used with chown_uploads.

# Xferlog_file =/var/log/vsftpd. Log

Xferlog_std_format = yes use the standard ftpd xferlog log format

# Idle_session_timeout = 600 this setting will be interrupted after the user's session is idle for 10 minutes

# Data_connection_timeout = 120 will be interrupted after the data connection is idle for 2 minutes

# Ascii_upload_enable = Yes enable the upload ASCII Transmission Mode

# Ascii_download_enable = Yes enable the download ASCII Transmission Mode

# Ftpd_banner = welcome to blah FTP service

# Deny_email_enable = No. The default value of this parameter is no. If the value is yes, you are not allowed to use the banned_email_file parameter to specify the e-mail address listed in the file.

# Banned_email_file =/etc/vsftpd. banned_emails specifies the file containing the rejected email address.

# Chroot_list_enable = yes: After logging on to a local user, you cannot switch to a directory other than your own directory.

# Chroot_list_file =/etc/vsftpd. chroot_list

# Ls_recurse_enable = Yes

Pam_service_name = vsftpd: Set the name of the configuration file for the PAM Authentication Service, which is stored in/etc/PAM. d/

Userlist_enable = yes this configuration/etc/vsftpd. the user specified in user_list cannot access the server either. If userlist_deny = No is added, only/etc/vsftpd is added. users in the user_list file can access the server, but other users cannot access the server. For example, if userlist_enable = No and userlist_deny = Yes, users specified in the file/etc/vsftpd. user_list cannot access the server, while other local users can access the server.
Listen = Yes indicates that vsftpd is started independently.

Tcp_wrappers = Yes TCP_WRAPPERS remote access control mechanism is used in vsftpd. The default value is yes.

 

3. Create an account named test for configuration.

After configuring FTP according to the actual situation, the following example shows how to create an FTP account and perform simple configuration:

 

1. Create an account named test:

# Mkdir/tmp/test // first create a directory

# Adduser-D/tmp/test-g ftp-S/sbin/nologin test //-S/sbin/nologin makes it unable to log on to the system, -D indicates that the user directory is/opt/srsman. That is, this account can only log on to FTP, but cannot log on to the system.

# Passwd Test

Changing password for user beinan. // you will be prompted to set a new password.

New password:

Retype new password:
Passwd: All authentication tokens updated successfully

Account Created!

 

2. restrict user directories and do not change directories to superiors.

Modify/etc/vsftpd. conf
Convert the two rows
# Chroot_list_enable = Yes
# Chroot_list_file =/etc/vsftpd. chroot_list
Comment removed
Chroot_list_enable = Yes
Chroot_list_file =/etc/vsftpd/chroot_list

Add a file:/etc/vsftpd/chroot_list
User name to be restricted for content writing:
Test

Restart vsftpd

# Service vsftpd restart

3. Add the FTP process to the Startup File to prevent the server from being shut down or restarted after it is started:

(1) Find the/etc/rc. Local file.

(2) open the file and add service vsftpd start in the last line.

(3) Save and exit

 

4. Enter ftp: // 192.168.179.30 (enter the IP address of the FTP server) in "My Computer" to enter the FTP server, and enter the configured account to log in.

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.