vsftpd - "553 could not create file"

12,698

I'm not sure why (perhaps a bug?), even though nopriv_user was set to apache, somehow vsftpd was thinking it set to ftp:

# grep ^nopriv_user vsftpd.conf
nopriv_user=apache
#

... yet when I upload file it's like nopriv_user is set to ftp:

# ls -ld test test/13924501638_26bbdf9023_o.jpg
drwxrwxr-x. 2 apache ftp      41 Jun 17 13:01 test
-rw-r--r--. 1 ftp    ftp 2885458 Jun 17 13:01 test/13924501638_26bbdf9023_o.jpg
# 

So, unless I'm doing something wrong, maybe I should submit it to vsftpd as bug.

Share:
12,698

Related videos on Youtube

alexus
Author by

alexus

Consulting | alexus.biz Dmitry Chorine | LinkedIn a1exus (a1exus) on Twitter Verify a Red Hat Certified Professional | redhat.com

Updated on September 18, 2022

Comments

  • alexus
    alexus over 1 year

    I'm having issue with my vsftpd.

    here is my info:

    # cat /etc/redhat-release 
    Red Hat Enterprise Linux Server release 7.0 (Maipo)
    # uname -a
    Linux ip-10-150-53-42.ec2.internal 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
    # rpm -q vsftpd
    vsftpd-3.0.2-9.el7.x86_64
    # ll -d /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS
    drwxr-xr-x. 2 root root 98 Jun 13 20:33 /usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS
    # grep -v ^# /etc/vsftpd/vsftpd.conf
    anonymous_enable=NO
    local_enable=YES
    write_enable=YES
    local_umask=022
    dirmessage_enable=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    xferlog_std_format=YES
    chroot_local_user=YES
    listen=NO
    listen_ipv6=YES
    
    pam_service_name=vsftpd.pam
    userlist_enable=YES
    tcp_wrappers=YES
    
    guest_enable=YES
    local_root=/var/www/html/$USER
    user_sub_token=$USER
    hide_ids=YES
    nopriv_user=apache
    virtual_use_local_privs=YES
    log_ftp_protocol=YES
    xferlog_std_format=YES
    syslog_enable=YES
    # getsebool ftp_home_dir
    ftp_home_dir --> on
    # 
    

    I'm trying to utilize virtual users feature inside of vsftpd and while authentication part works without any issues, unfortunately write doesn't work.

    # ls -ld /var/www/html/
    drwxr-xr-x. 5 root root 71 Jun 14 13:45 /var/www/html/
    # ls -ld /var/www/html/test/
    drwxrwxr-x. 2 apache apache 30 Jun 14 14:45 /var/www/html/test/
    # cd /etc/
    # ftp 0
    Connected to 0 (0.0.0.0).
    220 (vsFTPd 3.0.2)
    Name (0:root): test
    331 Please specify the password.
    Password:
    230 Login successful.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> put fstab
    local: fstab remote: fstab
    227 Entering Passive Mode (127,0,0,1,202,176).
    553 Could not create file.
    ftp> 221 Goodbye.
    # 
    

    I've tried to disabling(permissive) and enabling(enforcing) SELinux and still same undesirable result(

    What am I missing?

  • alexus
    alexus almost 10 years
    actually dir owner is NOT root, it's actually apache.