Centos Ftp Configuration

1. Log in with the root user and install vsftpd through yum

 

[root@localhost ~]# yum -y install vsftpd

 2. Set to boot

 

 

[root@localhost ~]# chkconfig vsftpd on

 3. Uncomment the following lines to make the configuration take effect:

 

   vi /etc/vsftpd/vsftpd.conf

 

# Prohibit anonymous users from logging in anonymously
anonymous_enable=NO
# Allow local users to log in
local_enable=YES
# Let the logged in user have write permission (upload, delete)
write_enable=YES
# default umask
local_umask=022
# use port 20 to transmit data
connect_from_port_20=YES
# When logging in, you can also append the user to /etc/vsftpd/ftpusers.
pam_service_name=vsftpd
userlist_enable=YES

 4. After the configuration is saved, restart the vsftpd service:

 

 

[root@localhost ~]# service vsftpd restart

 5. Configure the server firewall to open ports

 

     Enter the upper left corner of the graphical interface - "Applications -" Miscellaneous - "Firewall

     Switch to service check FTP, switch to port to add TCP protocol port 20 and port 21

6. Configure selinux

[root@localhost ~]#getsebool -a |grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
allow_tftp_anon_write --> off
ftp_home_dir --> off
ftpd_connect_db --> off
ftpd_disable_trans --> off
ftpd_is_daemon --> on
httpd_enable_ftp_server --> off

 At this time, we need to turn on the value of ftp_home_dir to on:, and allow_ftpd_full_access can also be turned on together.

[root @ localhost ~] #setsebool -P ftp_home_dir 1
[root@localhost ~]#setsebool -P allow_ftpd_full_access 1

 7. Restart the service and try the FTP connection with the existing username

If my IP is 10.0.0.161, then accessing ftp://10.0.0.161/ from other hosts on the intranet will prompt to enter the username and password to complete the connection

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326458345&siteId=291194637