Linux-install and configure vsftpd in CentOS,-centosvsftpd
Bad environment:CentOS 1, 7.0
There is not much gossip. Let's get started with the subject.
Step 1: Install vsftpd and run it on the terminal
yum -y install vsftpd
Test whether the installation is successful
service vsftpd start
If the prompt is:
Starting vsftpd for vsftpd: [ok]
Success.
Step 2: edit the vsftpd configuration file
vi /etc/vsftpd/vsftpd.conf
Clear the file and add the following content:
listen=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
Step 3: run the following command on the terminal
touch /etc/vsftpd/vsftpd.chroot_list service vsftpd start
If the following sentence appears:
Starting vsftpd for vsftpd: [OK]
The statement is successful. If not, use this statement:
/etc/rc.d/init.d/xinetd restart
Step 4: add an ftp user
By default, ftp uses the System user. Now we add the user csuldw, pointing to the directory/home/csuldw
, Permission isnologin
That is, the shell permission is not given and ftp is not affected.
useradd csuldw -d /home/csuldw -s /sbin/nologin
If:
Useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Ignore this. It just tells you that the directory you direct to already exists, which does not affect
You can also use other grouping methods to set the group of directories and their files, as follows:
chown -R csuldw.csuldw /home/csuldw
Set the password of the user csuldw and set it by yourself. The command is as follows:
passwd csuldw
Add the user csuldw/etc/vsftpd/vsftpd.chroot_list
In this way, the user can log on normally and cannot jump out of his directory
echo 'csuldw' >> /etc/vsftpd/vsftpd.chroot_list service vsftpd restart
Step 5: Test
Configuration complete! Test Login
Ftp host: Enter the Server IP address as follows:ftp 192.168.0.1
Ftp user: Csuldw
Ftp Password: You just set
Note: It is best to disable the firewall when performing FTP operations.
service iptables stop
By default, the root account is not allowed to upload files.
Implement root permission upload:
Vi/etc/vsftpd/user_list # root comment out vi/etc/vsftpd/ftpusers # root comment out
Client Software upload error:
553 cocould not create file.
Cause: No write permission.
Solution:
chmod 777 /var/ftp/pub