VSFTPD does not allow upload with virtual users

Posted by Mr. Squig on Server Fault See other posts from Server Fault or by Mr. Squig
Published on 2012-11-21T01:14:23Z Indexed on 2012/11/21 5:03 UTC
Read the original article Hit count: 581

Filed under:
|
|
|

I am attempting to setup VSFTPD with virtual users on a server running Ubuntu 12.04. I have configured the server to allow for virtual users to login, but I am having trouble getting it to allow uploads. My vsftpd.conf is as follows:

listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES

chroot_local_user=YES
virtual_use_local_privs=YES
guest_enable=YES
guest_username=virtual
user_sub_token=$USER
local_root=/var/www/$USER
hide_ids=YES

secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem

/etc/pam.d/vsftpd contains:

auth required pam_pwdfile.so pwdfile /etc/vsftpd.passwd crypt=hash
account required pam_permit.so crypt=hash

I have two virtual users set up, one of which has the same name as a local user. They each have a directory in /var/www/ owned by 'virtual'. As I understand it, when a virtual user logs in this way they will appear to the system as the user virtual. Using this configuration user can log on, but cannot upload files. The error given in /var/log/vsftpd.log is:

Tue Nov 20 19:49:00 2012 [pid 2] CONNECT: Client "96.233.116.53"
Tue Nov 20 19:49:07 2012 [pid 1] [zac] OK LOGIN: Client "96.233.116.53"
Tue Nov 20 19:49:11 2012 [pid 2] CONNECT: Client "96.233.116.53"
Tue Nov 20 19:49:11 2012 [pid 1] [zac] OK LOGIN: Client "96.233.116.53"
Tue Nov 20 19:49:11 2012 [pid 3] [zac] FAIL CHMOD: Client "96.233.116.53", "/test.ppm 644"

I have tried changing the permissions of these directories in all sorts of ways, but nothing seem to work. I have a feeling that it is something simple related to permissions. Any ideas?

© Server Fault or respective owner

Related posts about ubuntu

Related posts about virtualization