Enable ftp in centos 6

Source: Internet
Author: User
Tags default ftp port ftp client

Enable ftp in centos 6

1. Install the vsftpd component

[Plain] view plaincopy
  1. Yum-yinstallvsftpd
The ftp service is not started.
[Plain] view plaincopy
  1. Servicevsftpdstart
2. Install the ftp client component
[Plain] view plaincopy
  1. Yum-yinstallftp
Execute the command and try to log on
[Plain] view plaincopy
  1. Ftplocalhost
Enter the ftp user name and password (because anonymous access is allowed by default)
If the logon succeeds, the ftp service is available.
3. Cancel anonymous login
[Plain] view plaincopy
  1. Vi/etc/vsftpd. conf
Change anonymous_enable = YES in the first line to NO
Restart
[Plain] view plaincopy
  1. Servicevsftpdrestart
4. Create a new user (ftpuser is the user name and can be used as needed)
[Plain] view plaincopy
  1. Useraddftpuser
Change Password (twice)
[Plain] view plaincopy
  1. Passwdftpuser
After such a user is created, you can use this logon. Remember to use normal logon instead of anonymous logon. The default path after logon is/home/ftpuser.
5. Open Port 21
Because the default ftp port is 21, and centos is not enabled by default, You need to modify the iptables File
[Plain] view plaincopy
  1. Vi/etc/sysconfig/iptables
On the row, enter another line under 22-j ACCEPT, and change 22 to 21, and save the input.
And restart iptables.
[Plain] view plaincopy
  1. Serviceiptablesrestart
The Internet can be accessed, but the directory cannot be returned or uploaded because selinux is an exception.
6. Modify selinux
[Plain] view plaincopy
  1. Getsebool-a | grepftp
Run the preceding command, and then the returned result shows that both rows are off, indicating that Internet access is not enabled.
Allow_ftpd_full_access off
....
....
Ftp_home_dir off
You just need to turn all the above into on.
Run
[Plain] view plaincopy
  1. Setsebool-Pallow_ftpd_full_access1
  2. Setsebool-Pftp_home_dir1
Restart vsftpd.
[Plain] view plaincopy
  1. Servicevsftpdrestart
7. Enable passive Mode
It is enabled by default, but you need to specify a port range to open the vsftpd. conf file [plain] view plaincopy
  1. Vi/etc/vsftpd. conf
Add
Pasv_min_port = 30000
Pasvanderbilt max_port = 30999
Indicates the port range is 30000 ~ 30999. This can be changed at will.
Restart vsftpd.
[Plain] view plaincopy
  1. Servicevsftpdrestart
Because the port range is specified, iptables needs to enable the range accordingly, so open the iptables file as above.
It also starts another line on the upper and lower sides of 21, which is similar to that line, but changes the value of 21 to 30000: 30999, saves the line, and restarts iptables. This is done.

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.