Summary of failure to upload files and other problems in vsftp in Centos

Source: Internet
Author: User

Vsftp cannot upload files

After using SecureCRT for remote logon, I performed the following checks:

① The vsftp configuration file (/etc/vsftpd. conf) is opened and the write_enable status is checked:


[Root @ VM_72_108_centos/] # cat/etc/vsftpd. conf | grep write_enable
Write_enable = YES
# Anon_mkdir_write_enable = YES
[Root @ VM_72_108_centos/] #

② Check whether the ftp user has the permission to read and write the directory, and find that the ftp user is also in the 775 status (www group ).


[Root @ VM_72_108_centos wwwroot] # ll
Total 8
Drwxrwxr-x 3 www 4096 Jun 12 default
Drwxrwxr-x 9 www 4096 Jun 12 weixin.weightwl.com

③ When Using ftp in command prompt CMD, you can get some error messages that cannot be seen by explore to facilitate data search:


Therefore, baidu searched for the following error message:
200 PORT command successful. Consider using PASV.
425 Failed to establish connection.
 
Finally, the following solution was found in a linux Forum:
The author said that this problem only occurs on Centos, and Redhat does not. No wonder I have never seen this problem in my company.
Solution:
① Check the Selinux status of ftp: sestatus-B | grep ftp
② In the result, we can see: ftp_home_dir off
③ Change the status to on: setsebool-P ftp_home_dir on
4. restart the vsftp service: service vsftpd restart
It is a bit confusing that his server did not enable selinux at all, so step 2 has no result at all. Theoretically, this solution should be effective. But in fact, after all the operations are completed, you can upload files and create folders. I went there, but it was really strange. In short, it would be nice to solve the problem.

Zhang Ge added a command line commonly used to add FTP accounts in VPS to facilitate the definition of different ftp accounts:


Useradd-g www-d/home/www/zhangge.net-s/sbin/nologin username
#-G indicates the user group to which it belongs. Please Select
#-D indicates the working directory after logon. Specify the root directory of the website to be directed.
#-S/sbin/nologin indicates that this account is only used for ftp and cannot be logged on to the system.
# Customize the new username.
Passwd username
# Set the ftp user password using passwd.

Supplement: CENTOS6.4 VSFTP cannot upload files

Method 1: disable selinux directly. Command:/usr/sbin/setenforce 0;

Method 2: When selinux is enabled

Run the command (view the services enabled by ftpd): getsebool-a | grep ftp

The following figure shows that files cannot be uploaded: allow_ftp_anon_write

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.