Purpose: only allow users to access the specified directory with the FTP tool
See if the VSFTPD is installed
Rpm-qa|grep vsftpd
Installing VSFTPD
yum-y Install vsftpd(if installation is unsuccessful, download RPM package, install manually)
Edit the VSFTPD configuration file
Vi/etc/vsftpd/vsftpd.conf
Change to the following content, you can also directly empty, and then copy it in:
Isten=yes
Background=yes
Anonymous_enable=no
Local_enable=yes
Write_enable=yes
local_umask=022
Anon_upload_enable=no
Anon_mkdir_write_enable=no
Dirmessage_enable=yes
Xferlog_enable=yes
Connect_from_port_20=yes
Chown_uploads=no
Xferlog_file=/var/log/vsftpd.log
Xferlog_std_format=yes
Async_abor_enable=yes
Ascii_upload_enable=yes
Ascii_download_enable=yes
Ftpd_banner=welcome to Hao32 FTP servers
Pam_service_name=vsftpd
Chroot_local_user=no
Chroot_list_enable=yes
Chroot_list_file=/etc/vsftpd/vsftpd.chroot_list
Terminal run the following command
Touch/etc/vsftpd/vsftpd.chroot_list
Service VSFTPD Start
" If you want to add a new user and a new point to the directory, start here "
FTP Default We use System user, now we add user Ftptest, point to directory/home/ftptest, permission is Nologin, is not give shell permission, does not affect the FTP
# Useradd ftptest-d/home/ftptest-s/sbin/nologin
View Users and groups (you need to specify users and groups if the users and groups are not correct)
Cd/home
Ls-al
Set up a group of directories and their files, and you can also use other groupings
# Chown-r ftptest. Ftptest/home/ftptest
Set the user ftptest password
# passwd ftptest
Add user ftptest to/etc/vsftpd/vsftpd.chroot_list so that users can log in and not jump out of their own directory
# echo Ftptest >>/etc/vsftpd/vsftpd.chroot_list
# Service VSFTPD Restart
Test Login
FTP Host: Server IP Address "ftp 192.168.0.9"
FTP User: Ftptest
FTP Password: ftptest
or enter in the browser: ftp://192.168.0.9
If this is the time to meet cannot change directory/home/ftptest
View Status:
Getsebool-a|grep FTP
Use the Setsebool command to turn on
# setsebool-p Ftpd_disable_trans 1
Or
# setsebool-p Ftp_home_dir 1
View whether the current state is on
# Getsebool-a|grep FTP
Ftpd_disable_trans-On
Or
Ftp_home_dir-->on
Restart:Service vsftpd Restart
CentOS Installation VSFTPD