Quickly build an ftp server in CentOS 6.5

Source: Internet
Author: User
Tags nameserver

Quickly build an ftp server in CentOS 6.5

Quickly build an ftp server in CentOS 6.5

1. Use root to enter the system

2. Run the command rpm-qa | grep vsftpd to check whether ftp is installed. If vsftp is installed, the vsftpd version is displayed on the screen.

3. Run the command rpm-e vsftpd to uninstall ftp.

4. Run rpm-qa | grep vsftpd to check whether ftp has been deleted. If the ftp has been deleted successfully, the vsftpd version is displayed on the screen.

1. Install vsftpd

Check whether vsftpd has been installed
Rpm-qa | grep vsftpd

If not, install and set the startup
Yum-y install vsftpd
Chkconfig vsftpd on

Error detected during installation:

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Cocould not retrieve than list http://mirrorlist.centos.org /? Release = 6 & arch = x86_64 & repo = OS error was
14: pycurl error 6-"Couldn't resolve host 'using list .centos.org '"
Error: Cannot find a valid baseurl for repo: base

Because DNS is missing, the solution is as follows: Configure resolv. conf In The/etc directory to add nameserver IP:
[Root @ localhost ~] # Vi/etc/resolv. conf

# The following address is Fujian Telecom DNS
Nameserver 218.85.157.99

Manage vsftpd commands:

Start vsftpd: service vsftpd start

Stop vsftpd: service vsftpd stop

Restart vsftpd: service vsftpd restart

2. configure the firewall

Open the/etc/sysconfig/iptables File
Vi/etc/sysconfig/iptables

Add the following code before the REJECT line
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 21-j ACCEPT

Save and close files and restart Firewall
Service iptables start

3. Configure the vsftpd Server

1. The default configuration file is/etc/vsftpd. conf. You can open it in a text editor.
Vi/etc/vsftpd. conf

2. Add an ftp user

Add the ftpuser user and set the root directory to/home/wwwroot/ftpuser. Disable the user from logging on to SSH and restrict access to other directories.
# Chroot_list_enable = YES
# (Default follows)
# Chroot_list_file =/etc/vsftpd. chroot_list

Change
Chroot_list_enable = YES
# (Default follows)
Chroot_list_file =/etc/vsftpd/chroot_list

3. added the user ftpuser to point to the/home/wwwroot/ftpuser directory. The SSH permission is prohibited.
Useradd-d/home/wwwroot/ftpuser-g ftp-s/sbin/nologin ftpuser

4. Set the User Password
Passwd ftpuser

5. edit the file chroot_list:
Vi/etc/vsftpd/chroot_list

The content is the ftp user name, and each user occupies one line, for example:

Peter
John

6. Restart vsftpd.
Service vsftpd restart

In addition, you can use scripts officially released by centos to manage ftp usernames in the future. Address: (unused)

Http://wiki.centos.org/HowTos/Chroot_Vsftpd_with_non-system_users

----------------------------------

Error

1. 500 OOPS: cannot change directory
Solution:

Enter the following command on the terminal:

1. setsebool-P ftpd_disable_trans 1

2. service vsftpd restart

OK!
Cause: selinux is enabled on the server, which limits FTP logon.

This article permanently updates the link address:

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.