Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have the following config on my Ubuntu 12 server:

1 - vsftpd installed and configured with the config file settings:

listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dir_message_enable=YES
use_locatime=YES
xferlog_enable=YES
connect_from_port_20=YES

chroot_local_user=YES
#chroot_list_enable=YES  (commented out)
chroot_list_file=/etc/vsftpd.chroot_list

secure_choot_dir=/var/run/vsftpd/empty

pam_service_name=vsftpd

rsa_cert_file=/ect/ssl/private/vsftpd.pem

user_config_dir=/etc/vsftpd/user_conf

2 - I have an ftp user setup in which their home directory is

var/www

3 - When I connect to the server with filezilla with the new ftp username, filezilla automatically shows the webroot, as desired.

The problem is the permissions of the files; every file the ftpuser uploads to the var/www directory are set so both the owner and the group of the file is of the ftp user.

Also the permissions are

-rw-------

Which of course means every file a try to access through a std browser receives the forbidden warning.

The var/www's owner is 'www-data' and the group is 'webroot'.

webroot is a group i created seperately and added the ftp user to, along with a few others.

How can I best correct this so that a std browser doesn't receive the forbidden warning when trying to view a file uploaded by the ftp user?

Thanks,

John

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Firstly I believe you should do a chmod g+s on /var/www. This will ensure that files created in this directory inherit the group from the parent directory.

Secondly, it looks like the file mode can be controlled by a vspftpd.conf value:

file_open_mode
 The permissions with which uploaded files are created. Umasks are applied on top of 
 this value. You may wish to change to 0777 if you want uploaded files to be executable.
 Default: 0666

If you're still having problems, have a look at the umask for the FTP user, this may be set in the user's ~/.bashrc

share|improve this answer
    
Thanks, I also added the following: local_umask=022 chmod_enable=YES file_open_mode=0755 This seems to have fixed the permissions issue but I will give your g+s suggestion a go to make the files inherit the correct groups as well. Thanks –  John Feb 9 '13 at 16:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.