0

i installed vsftpd and got it running with user ftpuser. owner group of /var/www is set to ftpuser:ftpuser. I can upload view, edit and delete files, which is nice.

but a website can't do anything: e.g. can't upload files via php, can't run installer and stuff. so i changed owner to www-data:www-data. Now i can upload files via http or update my wordpress. but i can not change files via ftp anymore (550 Create directory operation failed).

i have added ftpuser to group www-data but still can't do anything on the server.

my vsftpd.conf

listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
force_dot_files=YES
pasv_min_port=40000
pasv_max_port=50000
allow_writeable_chroot=YES
tvaqsct
  • 1
  • 1

1 Answers1

0

2 different processes (apache and vsftp) have/run with different users and groups: files and directories have user ownership and group ownership so you need to configure proper permissions to let apache read/write in/on-to files and directories owned by vsftp (or vice versa according to how you configure permissions and groups).

A solution could be:

  • create a common group called, for example, 'web-manager'
  • change the group of the folder '/var/www' to web-manager (chgrp web-manager /var/www)
  • allow those who are in 'web-manager' group write into the '/var/www' folder (chmod 775 /var/www)
  • put apache and vsftp in the group 'web-manager' (usermod -a -G web-manager www-data; usermod -a -G web-manager ftpuser)
  • restart apache and vsftp daemons
Inc0
  • 789
  • 1
  • 4
  • 12