Ftp – vsftpd default permissions for website directory and ftp

ftppermissionsunixvsftpd

I'm trying to setup vsftpd and my users correctly. I can connect to the ftp with my user but I can't create any directory or file. My websites folder will be there: /srv/www/domain

vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
chroot_local_user=YES

Directory permissions

drwxrwxr-x  4 root www-data 4096 Oct  5 20:58 www

drwxrwxr-x 2 user_ftp www-data 4096 Oct  5 22:19 domain

User group

user_ftp => www-data

It's strange because when the domain folder have:

  • 755 permission: I can't connect to my FTP account (500 OOPS: vsftpd: refusing to run with writable root inside chroot()) but I can add files & folders (if i change the permission when i'm logged)
  • 575 permission: I can connect, but can't edit/delete/add files & folders

What I'm doing wrong :)?

Best Answer

My solution.

with chroot_local_user set to YES, the root should be the owner of the home directory, after that you can create other directory and assign permission to the FTP USER so he can do everything he want.

Root user access/permission to /srv/www/domain

FTP user access/permission to /srv/www/domain/public_html