Why Vsftp anonymous users cannot download and resolve
Source: Internet
Author: User
Vsftp anonymous users cannot download the Cause Analysis and Solution-Linux Enterprise Application-Linux server application information. The following is a detailed description. Why Vsftp anonymous users cannot download and resolve
Recently, in the group, I encountered the above problems when I did my exercises, and I did not find a definite answer on the search network; later, I checked a large number of related articles and materials. Now I have analyzed and solved this problem for the reference of many new vsftp learners: (this problem has nothing to do with firewall, disable iptables)
Parameters related to anonymous users in vsftp:
1) Main configuration file:/etc/vsftpd. conf
--------------------------------------------------
[Root @ station ~] # Cat/etc/vsftpd. conf | grep-v ^ #
Anonymous_enable = YES
Local_enable = YES
Write_enable = YES
Local_umask = 022 // umask value of the File Uploaded by the local user.
Anon_upload_enable = YES // anonymous upload is allowed
Anon_mkdir_write_enable = YES // anonymous users can perform write operations on directories.
Dirmessage_enable = YES
Xferlog_enable = YES
Connect_from_port_20 = YES
Xferlog_std_format = YES
Listen = YES
Pam_service_name = vsftpd
Userlist_enable = YES
Tcp_wrappers = YES
---------------------------------------------------
2) Check related selinux settings:
---------------------------------------------------
[Root @ station ~] # Getsebool-a | grep ftp
Allow_ftpd_anon_write --> on // write permission for anonymous users. Enable
Allow_ftpd_full_access --> on // to upload files to anonymous users, enable
Allow_ftpd_use_cifs --> off
Allow_ftpd_use_nfs --> off
Allow_tftp_anon_write --> off
Ftp_home_dir --> on // local user's home directory
Ftpd_disable_trans --> off // disable the influence of selinux on the ftp service
Ftpd_is_daemon --> on
Httpd_enable_ftp_server --> off
Tftpd_disable_trans --> off
------------------------------------------------------
Follow the settings above to restart the service. Most of the articles that newcomers see are basically configured in this way, but the problems we encounter arise.
Symptom: anonymous users can log on to the ftp server (either a linux client or a windows client). They can use a linux client to upload files and create directories. They can use a windows client to upload files, you cannot change the name of a Created directory. You can only create a folder with a new folder ......
Analysis:
1. Permission issues must be identified.
2. Disable selinux testing. The problem persists. The description is irrelevant to selinux.
3. Let's take a look at the files we uploaded:
1) permission for the target directory:
------------------------------------------------------
[Root @ station booleans] # ll/var/ftp/
Total 16
Drwxr-xr-x 2 root 4096 2007-12-13 pub
Drwxrwxrwx 2 root 4096 09-15 test // 777 permission OK
------------------------------------------------------
2) permissions for uploaded files:
------------------------------------------------------
Lftp 192.168.1.10:/test> put/root/install. log ./
27001 bytes transferred
Lftp 192.168.1.10:/test> ls
-Rw ------- 1 14 50 27001 Sep 15 install. log
------------------------------------------------------
Pay attention to the permission 600, which is the main reason why we cannot download it.
Solution:
In/etc/vsftpd. conf, only local_umask = 022 is available. It determines the File Upload permission after a month. The default file permission is 666, And the directory permission is 777. However, the permission of the File Uploaded by our anonymous users is not specified. What is the umask value of the default vsftp service for anonymous users?According to our test, it should be 066. So we need to modify the umask value of anonymous users so that we can perform some related operations, add anon_umask = 022, restart the service, and then test whether vsftp can be downloaded?
-----------------------------------------------------
Lftp localhost:/test> put/root/install. log
27001 bytes transferred
Lftp localhost:/test> ls
-Rw-r -- 1 14 50 27001 Sep 15 install. log
-----------------------------------------------------
What is the directory permission? Test by yourself. Pay attention to data security and set a proper umask value.
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